Skip to content
Navigation

Tabs

Fixed and scrollable tab rows

Tabs organize content across parallel sections of a screen. A fixed TabRow splits the available width evenly, while a ScrollableTabRow keeps each tab at its natural width and scrolls horizontally when they overflow.

Tabs demos rendered in Compose Playground
Pixel-accurate preview · light theme

Examples

01

Fixed tabs

Three evenly spaced tabs with content below.

Kotlin
var selected by remember { mutableIntStateOf(0) }
val titles = listOf("Overview", "Specs", "Reviews")
TabRow(selectedTabIndex = selected) {
    titles.forEachIndexed { index, title ->
        Tab(
            selected = selected == index,
            onClick = { selected = index },
            text = { Text(title) }
        )
    }
}
Text("Showing: ${titles[selected]}")
02

Scrollable tabs

Many tabs scroll horizontally rather than compressing.

Kotlin
var selected by remember { mutableIntStateOf(0) }
val titles = listOf("Daily", "Weekly", "Monthly", "Quarterly", "Yearly")
ScrollableTabRow(selectedTabIndex = selected) {
    titles.forEachIndexed { index, title ->
        Tab(
            selected = selected == index,
            onClick = { selected = index },
            text = { Text(title) }
        )
    }
}
Text("Showing: ${titles[selected]}")