New Compose Multiplatform components arrived on Composables UICheck it out →

Component in Material 3 Compose

LeadingIconTab

Common

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 of a [TabRow], see the corresponding documentation for example usage.

Last updated:

Installation

dependencies {
   implementation("androidx.compose.material3:material3:1.3.0-beta04")
}

Overloads

@Composable
fun LeadingIconTab(
    selected: Boolean,
    onClick: () -> Unit,
    text: @Composable () -> Unit,
    icon: @Composable () -> Unit,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    selectedContentColor: Color = LocalContentColor.current,
    unselectedContentColor: Color = selectedContentColor,
    interactionSource: MutableInteractionSource? = null
)

Parameters

namedescription
selectedwhether this tab is selected or not
onClickcalled when this tab is clicked
textthe text label displayed in this tab
iconthe icon displayed in this tab. Should be 24.dp.
modifierthe [Modifier] to be applied to this tab
enabledcontrols the enabled state of this tab. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.
selectedContentColorthe color for the content of this tab when selected, and the color of the ripple.
unselectedContentColorthe color for the content of this tab when not selected
interactionSourcean optional hoisted [MutableInteractionSource] for observing and emitting [Interaction]s for this tab. You can use this to change the tab's appearance or preview the tab in different states. Note that if null is provided, interactions will still happen internally. @see Tab