WideNavigationRailItem

Material Design wide navigation rail item.

WideNavigationRailItem

Composable Component

Material Design wide navigation rail item.

Common
@Composable
fun WideNavigationRailItem(
    selected: Boolean,
    onClick: () -> Unit,
    icon: @Composable () -> Unit,
    label: @Composable (() -> Unit)?,
    railExpanded: Boolean,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    iconPosition: NavigationItemIconPosition =
        WideNavigationRailItemDefaults.iconPositionFor(railExpanded),
    colors: NavigationItemColors = WideNavigationRailItemDefaults.colors(),
    interactionSource: MutableInteractionSource? = null,
    indicatorPadding: PaddingValues =
        WideNavigationRailItemDefaults.indicatorPadding(railExpanded = railExpanded),
)

Parameters

selectedwhether this item is selected
onClickcalled when this item is clicked
iconicon for this item, typically an Icon
labeltext label for this item
railExpandedwhether the associated WideNavigationRail is expanded or collapsed
modifierthe Modifier to be applied to this item
enabledcontrols the enabled state of this item. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.
iconPositionthe NavigationItemIconPosition for the icon
colorsNavigationItemColors that will be used to resolve the colors used for this item in different states. See WideNavigationRailItemDefaults.colors
interactionSourcean optional hoisted MutableInteractionSource for observing and emitting Interactions for this item. You can use this to change the item's appearance or preview the item in different states. Note that if null is provided, interactions will still happen internally.
indicatorPaddingthe spacing values to apply internally between the indicator and the indicator's content, if you need different paddings during expanded and collapsed states, use WideNavigationRailItemDefaults.indicatorPadding to correctly handle animations.
Common

Deprecated Deprecated in favor of function with indicatorPadding parameter

@Composable
fun WideNavigationRailItem(
    selected: Boolean,
    onClick: () -> Unit,
    icon: @Composable () -> Unit,
    label: @Composable (() -> Unit)?,
    railExpanded: Boolean,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    iconPosition: NavigationItemIconPosition =
        WideNavigationRailItemDefaults.iconPositionFor(railExpanded),
    colors: NavigationItemColors = WideNavigationRailItemDefaults.colors(),
    interactionSource: MutableInteractionSource? = null,
) =
    WideNavigationRailItem(
        selected,
        onClick,
        icon,
        label,
        railExpanded,
        modifier,
        enabled,
        iconPosition,
        colors,
        interactionSource,
        WideNavigationRailItemDefaults.indicatorPadding(railExpanded = railExpanded),
    )

Parameters

selectedwhether this item is selected
onClickcalled when this item is clicked
iconicon for this item, typically an Icon
labeltext label for this item
railExpandedwhether the associated WideNavigationRail is expanded or collapsed
modifierthe Modifier to be applied to this item
enabledcontrols the enabled state of this item. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.
iconPositionthe NavigationItemIconPosition for the icon
colorsNavigationItemColors that will be used to resolve the colors used for this item in different states. See WideNavigationRailItemDefaults.colors
interactionSourcean optional hoisted MutableInteractionSource for observing and emitting Interactions for this item. You can use this to change the item's appearance or preview the item in different states. Note that if null is provided, interactions will still happen internally.
Common

Deprecated Deprecated in favor of function with indicatorPadding required railExpanded parameters

@ExperimentalMaterial3ExpressiveApi
@Composable
fun WideNavigationRailItem(
    selected: Boolean,
    onClick: () -> Unit,
    icon: @Composable () -> Unit,
    label: @Composable (() -> Unit)?,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    railExpanded: Boolean = false,
    iconPosition: NavigationItemIconPosition =
        WideNavigationRailItemDefaults.iconPositionFor(railExpanded),
    colors: NavigationItemColors = WideNavigationRailItemDefaults.colors(),
    interactionSource: MutableInteractionSource? = null,
) =
    WideNavigationRailItem(
        selected,
        onClick,
        icon,
        label,
        railExpanded,
        modifier,
        enabled,
        iconPosition,
        colors,
        interactionSource,
        WideNavigationRailItemDefaults.indicatorPadding(railExpanded = railExpanded),
    )

Parameters

selectedwhether this item is selected
onClickcalled when this item is clicked
iconicon for this item, typically an Icon
labeltext label for this item
modifierthe Modifier to be applied to this item
enabledcontrols the enabled state of this item. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.
railExpandedwhether the associated WideNavigationRail is expanded or collapsed
iconPositionthe NavigationItemIconPosition for the icon
colorsNavigationItemColors that will be used to resolve the colors used for this item in different states. See WideNavigationRailItemDefaults.colors
interactionSourcean optional hoisted MutableInteractionSource for observing and emitting Interactions for this item. You can use this to change the item's appearance or preview the item in different states. Note that if null is provided, interactions will still happen internally.