When to use it
Use it for two or three locales. The host applies the locale; use a select for longer lists.
Cycle to the next locale with a pill that shows that locale.
Native example
Use it for two or three locales. The host applies the locale; use a select for longer lists.
private val appLocales = listOf(
LumenLocaleOption("English", "en"),
LumenLocaleOption("Español", "es"),
LumenLocaleOption("Français", "fr")
)
@Composable
fun LanguageSwitcher(language: String, onLanguageChange: (String) -> Unit) {
LumenLanguageToggle(
value = language,
onValueChange = onLanguageChange,
locales = appLocales
)
}Reference
The primary shared and platform-specific options exposed by LumenLanguageToggle.
| API | Values or type | Default | Description |
|---|---|---|---|
| value / locales / labelTemplate | current locale / label and value pairs / accessible name template | first locale / English, Español / Change language from {current} to {next} | Use it for two or three locales. |
Native behavior
Use it for two or three locales. The host applies the locale; use a select for longer lists.
The label reads the current and the next language.
Shared component