When to use it
Items are independent. Use a segmented control when exactly one option must be chosen.
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
Items are independent. Use a segmented control when exactly one option must be chosen.
import LumenUI
import SwiftUI
struct ToggleGroupExample: View {
@State private var formatting: Set<String> = ["bold"]
var body: some View {
LumenToggleGroup("Text formatting", selection: $formatting, items: [
.init(id: "bold", label: "Bold"),
.init(id: "italic", label: "Italic", icon: .italic),
.init(id: "underline", label: "Underline", icon: .underline),
.init(id: "locked", label: "Locked", isDisabled: true)
])
}
}Reference
The primary shared and platform-specific options exposed by LumenToggleGroup.
| API | Values or type | Default | Description |
|---|---|---|---|
| items / selection / label | buttons / pressed values / group name | required / none pressed / required | Items are independent. |
Native behavior
Items are independent. Use a segmented control when exactly one option must be chosen.
Named group; each item exposes pressed state.
Shared component