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

The name of the destination.

selected: BooleanRequired

Whether this item is the current destination.

onClick: () -> UnitRequired

Called when the item is clicked. Navigate and close the drawer here.

icon: (@Composable () -> Unit)?Optional

Default: null

An icon before the label.

badge: (@Composable () -> Unit)?Optional

Default: null

Something at the end of the item, like a count.

shape: ShapeOptional

Default: NavigationDrawerTokens.ActiveIndicatorShape.value

Sets the outline of the item. Default: fully round.

colors: NavigationDrawerItemColorsOptional

Default: NavigationDrawerItemDefaults.colors()

Sets item colors for selected and unselected. Make one with NavigationDrawerItemDefaults.colors.

interactionSource: MutableInteractionSource?Optional

Default: 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.

Drawer types and parts