androidx.compose.material3
NavigationDrawerItem
Composable function
A part of ModalNavigationDrawer. See that page for an overview and examples.
Parameters
@Composable
fun NavigationDrawerItem(
label: @Composable () -> Unit,
selected: Boolean,
onClick: () -> Unit,
modifier: Modifier = Modifier,
icon: (@Composable () -> Unit)? = null,
badge: (@Composable () -> Unit)? = null,
shape: Shape = NavigationDrawerTokens.ActiveIndicatorShape.value,
colors: NavigationDrawerItemColors = NavigationDrawerItemDefaults.colors(),
interactionSource: MutableInteractionSource? = null,
)
label: @Composable () -> UnitRequired
label: @Composable () -> UnitRequiredThe name of the destination.
selected: BooleanRequired
selected: BooleanRequiredWhether this item is the current destination.
onClick: () -> UnitRequired
onClick: () -> UnitRequiredCalled when the item is clicked. Navigate and close the drawer here.
icon: (@Composable () -> Unit)?Optional
icon: (@Composable () -> Unit)?OptionalDefault: null
An icon before the label.
badge: (@Composable () -> Unit)?Optional
badge: (@Composable () -> Unit)?OptionalDefault: null
Something at the end of the item, like a count.
shape: ShapeOptional
shape: ShapeOptionalDefault: NavigationDrawerTokens.ActiveIndicatorShape.value
Sets the outline of the item. Default: fully round.
colors: NavigationDrawerItemColorsOptional
colors: NavigationDrawerItemColorsOptionalDefault: NavigationDrawerItemDefaults.colors()
Sets item colors for selected and unselected. Make one with NavigationDrawerItemDefaults.colors.
interactionSource: MutableInteractionSource?Optional
interactionSource: MutableInteractionSource?OptionalDefault: null
Lets you observe or control press, hover and focus states. Leave it null unless your code must react to them. See InteractionSource.
Same as in ModalNavigationDrawer: modifier.