LeadingIconTab

fun RowScope.LeadingIconTab(selected: Boolean, onClick: () -> Unit, text: @Composable () -> Unit, icon: @Composable () -> Unit, modifier: Modifier = Modifier, shape: Shape = RoundedCornerShape(16.dp), enabled: Boolean = true, selectedContentColor: Color = LocalContentColor.current, unselectedContentColor: Color = selectedContentColor.copy(alpha = ContentAlpha.medium))

LeadingIconTab without ripple

Tabs organize content across different screens, data sets, and other interactions.

A LeadingIconTab represents a single page of content using a text label, and an icon in front of the label. It represents its selected state by tinting the text label and icon with selectedContentColor.

This should typically be used inside a TabRow.

LeadingIconTab(
selected = index == pagerState.currentPage,
text = {
Text(text = text, color = tabTextColor)
},
icon = {
Icon(imageVector = Icons.AutoMirrored.Filled.Send, contentDescription = null)
},
onClick = {
coroutineScope.launch {
pagerState.animateScrollToPage(index)
}
}
)

Parameters

selected

whether this tab is selected or not

onClick

the callback to be invoked when this tab is selected

text

the text label displayed in this tab

icon

the icon displayed in this tab

modifier

optional Modifier for this tab

shape

Defines the tab's shape.

enabled

controls the enabled state of this tab. When false, this tab will not be clickable and will appear disabled to accessibility services.

selectedContentColor

the color for the content of this tab when selected, and the color of the ripple.

unselectedContentColor

the color for the content of this tab when not selected

See also