Skip to main content
239

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Themes
Android docs
NavigationAndroid

Tabs

Switch a controlled native content panel from an accessible tab list.

Public APILumenTabsAndroid / Compose

Native example

Use Tabs

Use for two to five peer content views whose panel changes in place. Keep URL history and nested destination navigation in the application router; use Navigation bar for top-level app destinations.

Tabs 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 WorkspaceTabsExample() {
    var view by remember { mutableStateOf("overview") }

    LumenTabs(
        label = "Workspace views",
        options = listOf(LumenSelectionOption("overview", "Overview"), LumenSelectionOption("activity", "Activity")),
        value = view,
        onValueChange = { view = it }
    ) { selected ->
        LumenText(if (selected == "overview") "4 active projects and 12 members." else "Atlas 2.4 shipped this week.")
    }
}
Basic
The content lambda receives the selected value and builds its panel.
Disabled tab
Disable a tab the person cannot open yet instead of hiding it.

Reference

Public API

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

APIValues or typeDefaultDescription
labelStringRequiredNames the tab list for assistive technology.
panelAccessibilityLabelString?Selected tab labelNames the active panel using application-localized text without appending an English role description.
optionsList<LumenSelectionOption>RequiredProvides stable tab values, short labels, and optional disabled state.
valueStringRequiredStores the active tab.
onValueChange(String) -> UnitRequiredUpdates controlled tab selection.
contentNative content viewRequiredRenders the active panel while Lumen owns the tab list and panel relationship.

Native behavior

Design and accessibility

When to use it

Use for two to five peer content views whose panel changes in place. Keep URL history and nested destination navigation in the application router; use Navigation bar for top-level app destinations.

Accessibility

Every tab exposes selected and disabled state, the tab list has a readable name, and the active panel is announced when selection changes.

Shared component

Available on other platforms

React NativeApple / SwiftUI Web
Android docsCompose module