Skip to main content
239

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Themes
Android docs
ActionsAndroid

Toggle group

Group related pressed-state buttons in one frame.

Public APILumenToggleGroupAndroid / Compose

Native example

Use Toggle group

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

Toggle group rendered in the Android phone emulator Lumen playground
Captured exampleAndroid phone emulatorView dark appearance
kotlin
import androidx.compose.runtime.*
import com.santi020k.lumen.*

@Composable
fun FormattingToolbar() {
    var pressed by remember { mutableStateOf(setOf("italic")) }
    LumenToggleGroup(
        label = "Text formatting",
        items = listOf(
            LumenToggleOption("italic", "Italic", LumenIconName.Italic),
            LumenToggleOption("underline", "Underline", LumenIconName.Underline),
            LumenToggleOption("strikethrough", "Strikethrough", LumenIconName.Strikethrough)
        ),
        pressed = pressed,
        onPressedChange = { pressed = it }
    )
}
Android
A text-formatting toolbar whose buttons stay pressed independently.

Reference

Public API

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

APIValues or typeDefaultDescription
items / pressed / 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 NativeApple / SwiftUI Web
Android docsCompose module