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-dropdown
Custom Alpine directive that marks the Dropdown Root.
Trigger
-
x-dropdown:trigger
Custom Alpine directive that marks the Dropdown Trigger.
-
aria-controls
Type:
string
Accessibility attribute that communicates that the Dropdown Trigger controls the state and visibility of the Dropdown Menu.
Automatically handled with JavaScript.
-
aria-expanded
Type:
boolean
Default:false
Accessibility attribute that communicates whether the Dropdown Menu is expanded or collapsed.
Automatically handled with JavaScript.
-
aria-haspopup
Type:
string
Accessibility attribute that communicates that this component has an interactive popup element.
Automatically handled with JavaScript.
Content
-
x-dropdown:content
Custom Alpine directive that marks the Dropdown Content.
-
role
Type:
string
Value:'menu'
Automatically handled with JavaScript.
-
aria-labelledby
Type:
string
Accessibility attribute that links the Dropdown Content to the Dropdown Trigger via
id
.Automatically handled with JavaScript.
-
tabindex
Type:
number
Value:-1
Prevents users from tabbing to this element.
Automatically handled with JavaScript.
Item
-
x-dropdown:item
Custom Alpine directive that marks the Dropdown Item.
-
role
Type:
string
Value:'menuitem'
Automatically handled with JavaScript.
-
tabindex
Type:
number
Value:-1
Prevents 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.