Skip to content

LanguageSelector ⚠️ Experimental

The LanguageSelector component can be used imported from:

Playground

Parameters

Events

This component has events. Check the documentation about how to use the events.

NamePayloadDescription
changestringEmitted when the value changes
blurvoidEmitted when the input loses focus

Parameters use

Check the documentation about how to use the parameters.

INFO

Most of the parameters are exactly the same as Select component. Check its parameters section for more information.

model

Attention!

If you hardcode this value, it will not be reactive and the selection won't change. Use a variable instead and, ideally, a closed loop.

Controls the selected value of the input. The value needs to be one of the provided via locales

locales

it indicates the array of locales to display can be specified. Substitutes options in the Select component.

If no locales are provided, the component will use the ones injected in the ZDS_LOCALES variable of window. Read about this in the localization section

Special uses

Back to navigator language

If you press Alt + L, the component will change the language back to the navigator language. This is a default behavior that doesn't require special configuration.

We might want to provide the user this information with a toast if the language is to a different one than the navigator:

Press Alt + L to go back to the navigator language

Browser support

Detected engine:  

  • Chromium

  • Webkit

  • Gecko

HTML Examples

CodeSandbox example