Tab
Tab without ripple
Tabs organize content across different screens, data sets, and other interactions.
A Tab represents a single page of content using a text label and/or icon. It represents its selected state by tinting the text label and/or image with selectedContentColor.
This should typically be used inside a TabRow, see the corresponding documentation for example usage.
This Tab has slots for text and/or icon - see the other Tab overload for a generic Tab that is not opinionated about its content.
Tab(
selected = index == pagerState.currentPage,
text = {
Text(text = text, color = tabTextColor)
},
onClick = {
coroutineScope.launch {
pagerState.animateScrollToPage(index)
}
}
)
Parameters
whether this tab is selected or not
optional Modifier for this tab
controls the enabled state of this tab. When false
, this tab will not be clickable and will appear disabled to accessibility services.
the callback to be invoked when this tab is selected
the text label displayed in this tab
the icon displayed in this tab
Defines the tab's shape.
the color for the content of this tab when selected, and the color of the ripple.
the color for the content of this tab when not selected
See also
Tab without ripple
Tabs organize content across different screens, data sets, and other interactions.
Generic Tab overload that is not opinionated about content / color. See the other overload for a Tab that has specific slots for text and / or an icon, as well as providing the correct colors for selected / unselected states.
A custom tab using this API may look like:
Tab(
selected = index == pagerState.currentPage,
onClick = {
// on click
}
) {
// Content
}
Parameters
whether this tab is selected or not
the callback to be invoked when this tab is selected
optional Modifier for this tab
Defines the tab's shape.
controls the enabled state of this tab. When false
, this tab will not.
the color for the content of this tab when selected, and the color of the ripple.
the color for the content of this tab when not selected.
the content of this tab