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.
Examples
Toggle
Mobile
320pxMobile Lg
480pxTablet
640pxDesktop
1024pxDropdown
This component requires the following JavaScript plugin:
Mobile
320pxMobile Lg
480pxTablet
640pxDesktop
1024pxComponent API
Root
-
x-dropdownCustom Alpine directive that marks the Dropdown Root.
Trigger
-
x-dropdown:triggerCustom Alpine directive that marks the Dropdown Trigger.
-
aria-controlsType:
stringAccessibility attribute that communicates that the Dropdown Trigger controls the state and visibility of the Dropdown Menu.
Automatically handled with JavaScript.
-
aria-expandedType:
boolean
Default:falseAccessibility attribute that communicates whether the Dropdown Menu is expanded or collapsed.
Automatically handled with JavaScript.
-
aria-haspopupType:
stringAccessibility attribute that communicates that this component has an interactive popup element.
Automatically handled with JavaScript.
Content
-
x-dropdown:contentCustom Alpine directive that marks the Dropdown Content.
-
roleType:
string
Value:'menu'Automatically handled with JavaScript.
-
aria-labelledbyType:
stringAccessibility attribute that links the Dropdown Content to the Dropdown Trigger via
id.Automatically handled with JavaScript.
-
tabindexType:
number
Value:-1Prevents users from tabbing to this element.
Automatically handled with JavaScript.
Item
-
x-dropdown:itemCustom Alpine directive that marks the Dropdown Item.
-
roleType:
string
Value:'menuitem'Automatically handled with JavaScript.
-
tabindexType:
number
Value:-1Prevents users from tabbing to this element.
Automatically handled with JavaScript.
Keyboard Interactions
-
Down Arrow
When focus is on Dropdown Trigger, opens and moves focus to Dropdown Content.
When focus is on the Dropdown Content, moves focus to first Dropdown Item.
When focus is on a Dropdown Item, moves focus to next Dropdown Item.
-
Up Arrow
When focus is on Dropdown Trigger, opens and moves focus to Dropdown Content.
When focus is on the Dropdown Content, moves focus to last Dropdown Item.
When focus is on a Dropdown Item, moves focus to previous Dropdown Item.
-
Enter
When focus is on an Dropdown Item, selects that item.
-
Escape
When the Dropdown Content is open, closes the Dropdown Content and moves focus to the Dropdown Trigger.