When to use it
The host owns the scheme and applies it. Use a segmented control when people also need a system option.
Switch between the light and dark scheme with one round button.
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
The host owns the scheme and applies it. Use a segmented control when people also need a system option.
import LumenUI
import SwiftUI
struct AppearanceSetting: View {
@State private var scheme: LumenColorScheme = .light
var body: some View {
HStack(spacing: LumenSpacing.md) {
LumenThemeToggle(scheme: $scheme)
LumenText("Change the site theme", tone: .soft)
}
.lumenTheme(scheme == .dark ? .dark : .light)
}
}Reference
The primary shared and platform-specific options exposed by LumenThemeToggle.
| API | Values or type | Default | Description |
|---|---|---|---|
| scheme / onSchemeChange / label | current scheme / change callback / accessible name | required / required / Toggle color theme | The host owns the scheme and applies it. |
Native behavior
The host owns the scheme and applies it. Use a segmented control when people also need a system option.
Named Toggle color theme; the dark scheme reads as pressed.
Shared component