Language Selector (language_selector)

The consistent placement, interface, and behavior of the language selection component allows users to easily find and access content in the language the user is most comfortable in.

🔗 External documentation.

ID Label Description Schema
language_label Language label Label for the button
                        type: string

                      
items Language buttons
                        type: array
items:
    type: object
    properties:
        title:
            type: string
        attributes:
            $ref: '#/$defs/attributes_value'
        below:
            type: object

                      
            id: language_selector
label: 'Language Selector'
description: 'The consistent placement, interface, and behavior of the language selection component allows users to easily find and access content in the language the user is most comfortable in.'
group: Language
homepage: 'https://designsystem.digital.gov/components/language-selector/'
props:
    language_label:
        id: language_label
        label: 'Language label'
        description: 'Label for the button'
        schema:
            type: string
    items:
        id: items
        label: 'Language buttons'
        schema:
            type: array
            items:
                type: object
                properties:
                    title:
                        type: string
                    attributes:
                        $ref: '#/$defs/attributes_value'
                    below:
                        type: object
examples:
    preview:
        id: preview
        label: Preview
        renderable:
            '@component': language_selector
            language_label: 'Test language selector'
            items:
                -
                    label: English
                    url: /
                    attributes:
                        lang: en
                -
                    label: Spanish
                    url: /es
                    attributes:
                        lang: es
                -
                    label: French
                    url: /fr
                    attributes:
                        lang: fr

          
<div class="usa-language-container"> <ul class="usa-language__primary usa-accordion"> <li class="usa-language__primary-item"> <button aria-controls="language-options" aria-expanded="false" class="usa-language__link usa-button" type="button">Test language selector </button> <ul id="language-options" class="usa-language__submenu" hidden=""> <li class="usa-language__submenu-item"> <a href="&#x2f;"> <span >English</span> </a> </li> <li class="usa-language__submenu-item"> <a href="&#x2f;es"> <span >Spanish</span> </a> </li> <li class="usa-language__submenu-item"> <a href="&#x2f;fr"> <span >French</span> </a> </li> </ul> </li> </ul> </div>