Skip to main content
239

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Themes
Apple docs
ActionsApple

Toggle button

Turn one option on or off with a pressed-state button.

Public APILumenToggleButtonApple / 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 button

Use it for formatting or view options. Use a toggle switch for settings.

Toggle button rendered in the iPhone simulator Lumen playground
Captured exampleiPhone simulatorView dark appearance
swift
import LumenUI
import SwiftUI

struct ToggleButtonExample: View {
    @State private var isBold = true
    @State private var isItalic = false

    var body: some View {
        HStack {
            LumenToggleButton("Bold", isPressed: $isBold)
            LumenToggleButton("Italic", isPressed: $isItalic, icon: .italic, iconOnly: true)
            LumenToggleButton("Unavailable", isPressed: .constant(false), disabled: true)
        }
    }
}
Apple
A text toggle, an icon-only toggle with an accessible name, and a disabled toggle in one toolbar row.

Reference

Public API

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

APIValues or typeDefaultDescription
isPressed / label / iconcontrolled state / name / leading iconrequired / required / noneUse it for formatting or view options.

Native behavior

Design and accessibility

When to use it

Use it for formatting or view options. Use a toggle switch for settings.

Accessibility

Exposes pressed state; icon-only buttons keep the label as their name.

Shared component

Available on other platforms

React NativeAndroid / Compose
Apple docsSwiftUI package