← Back to Material Compose
LeadingIconTab
Overview
Code Examples
<a href="https://material.io/components/tabs" class="external" target="_blank">Material Design tab</a>.
Tabs organize content across different screens, data sets, and other interactions.
!Tab image(https://developer.android.com/images/reference/androidx/compose/material/tab.png)
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 of a TabRow, see the corresponding documentation for example usage.
@param selected whether this tab is selected or not @param onClick the callback to be invoked when this tab is selected @param text the text label displayed in this tab @param icon the icon displayed in this tab @param modifier optional Modifier for this tab @param enabled controls the enabled state of this tab. When false
, this tab will not be clickable and will appear disabled to accessibility services. @param interactionSource the MutableInteractionSource representing the different Interactions present on this tab. You can create and pass in your own remembered MutableInteractionSource if you want to read the Interaction and customize the appearance / behavior of this tab in different Interactions. @param selectedContentColor the color for the content of this tab when selected, and the color of the ripple. @param unselectedContentColor the color for the content of this tab when not selected
@see Tab
Overloads
LeadingIconTab
@Composable
fun LeadingIconTab(
selected: Boolean,
onClick: () -> Unit,
text: @Composable (() -> Unit),
icon: @Composable (() -> Unit),
modifier: Modifier = Modifier,
enabled: Boolean = true,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
selectedContentColor: Color = LocalContentColor.current,
unselectedContentColor: Color = selectedContentColor.copy(alpha = ContentAlpha.medium)
)
Parameters
Name | Description |
---|---|
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 |
enabled | controls the enabled state of this tab. When false , this tab will not be clickable and will appear disabled to accessibility services. |
interactionSource | the MutableInteractionSource representing the different Interactions present on this tab. You can create and pass in your own remembered MutableInteractionSource if you want to read the Interaction and customize the appearance / behavior of this tab in different Interactions. |
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 Ta |