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.
Apple availability
Import LumenUI in the target that uses this component. iPad support follows the iOS package baseline and uses native iPad layout behavior.
Native example
Use it for two or three locales. The host applies the locale; use a select for longer lists.
import LumenUI
import SwiftUI
struct LanguageSetting: View {
@State private var language = "en"
var body: some View {
LumenLanguageToggle(value: $language, locales: [
LumenLocaleOption("English", value: "en"),
LumenLocaleOption("Español", value: "es")
])
.environment(\.locale, Locale(identifier: language))
}
}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