TabGroup

fun TabGroup(state: TabGroupState, modifier: Modifier = Modifier, content: @Composable TabGroupScope.() -> Unit)

A foundational component used to build tabbed interfaces.

For interactive preview & code examples, visit Tab Group Documentation.

Basic Example

val tabState = rememberTabGroupState("tab1", listOf("tab1", "tab2", "tab3"))

TabGroup(state = tabState) {
TabList {
Tab(key = "tab1") {
Text("Tab 1")
}
Tab(key = "tab2") {
Text("Tab 2")
}
}
TabPanel(key = "tab1") {
Text("Content 1")
}
TabPanel(key = "tab2") {
Text("Content 2")
}
}

Parameters

state

The TabGroupState that controls the tab group.

modifier

Modifier to be applied to the tab group.

content

The content of the tab group.