Skip to main content
239

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Themes
Apple docs
ActionsApple

Toggle group

Group related pressed-state buttons in one frame.

Public APILumenToggleGroupApple / SwiftUISwift product: LumenUI

Apple availability

Supported native targets

Import LumenUI in the target that uses this component. iPad support follows the iOS package baseline and uses native iPad layout behavior.

iPhone · iOS 16+iPad · iPadOS 16+Mac · macOS 13+Apple Vision · visionOS 1+

Native example

Use Toggle group

Items are independent. Use a segmented control when exactly one option must be chosen.

Toggle group rendered in the iPhone simulator Lumen playground
Captured exampleiPhone simulatorView dark appearance
swift
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)
        ])
    }
}
Apple
A framed formatting group whose buttons toggle independently, with one disabled option.

Reference

Public API

The primary shared and platform-specific options exposed by LumenToggleGroup.

APIValues or typeDefaultDescription
items / selection / labelbuttons / pressed values / group namerequired / none pressed / requiredItems are independent.

Native behavior

Design and accessibility

When to use it

Items are independent. Use a segmented control when exactly one option must be chosen.

Accessibility

Named group; each item exposes pressed state.

Shared component

Available on other platforms

React NativeAndroid / Compose Web
Apple docsSwiftUI package