Tab

Composable Component

Material Design tab.

Android
@Composable
fun TabRowScope.Tab(
    selected: Boolean,
    onFocus: () -> Unit,
    modifier: Modifier = Modifier,
    onClick: () -> Unit = {},
    enabled: Boolean = true,
    colors: TabColors = TabDefaults.pillIndicatorTabColors(),
    interactionSource: MutableInteractionSource? = null,
    content: @Composable RowScope.() -> Unit
)

Parameters

selectedwhether this tab is selected or not
onFocuscalled when this tab is focused
modifierthe Modifier to be applied to this tab
onClickcalled when this tab is clicked (with D-Pad Center)
enabledcontrols the enabled state of this tab. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.
colorsthese will be used by the tab when in different states (focused, selected, etc.)
interactionSourcean optional hoisted MutableInteractionSource for observing and emitting Interactions for this tab. You can use this to change the tab's appearance or preview the tab in different states. Note that if null is provided, interactions will still happen internally.
contentcontent of the Tab