ShortNavigationBarItem

Functions summary

Unit
@Composable
ShortNavigationBarItem(
    selected: Boolean,
    onClick: () -> Unit,
    icon: @Composable () -> Unit,
    label: (@Composable () -> Unit)?,
    modifier: Modifier,
    enabled: Boolean,
    iconPosition: NavigationItemIconPosition,
    colors: NavigationItemColors,
    interactionSource: MutableInteractionSource?
)

Material Design short navigation bar item.

Cmn

Functions

ShortNavigationBarItem

@Composable
fun ShortNavigationBarItem(
    selected: Boolean,
    onClick: () -> Unit,
    icon: @Composable () -> Unit,
    label: (@Composable () -> Unit)?,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    iconPosition: NavigationItemIconPosition = NavigationItemIconPosition.Top,
    colors: NavigationItemColors = ShortNavigationBarItemDefaults.colors(),
    interactionSource: MutableInteractionSource? = null
): Unit

Material Design short navigation bar item.

Short navigation bars offer a persistent and convenient way to switch between primary destinations in an app.

It's recommend for navigation items to always have a text label. An ShortNavigationBarItem always displays labels (if they exist) when selected and unselected.

The ShortNavigationBarItem supports two different icon positions, top and start, which is controlled by the iconPosition param:

  • If the icon position is NavigationItemIconPosition.Top the icon will be displayed above the label. This configuration is recommended for short navigation bars used in small width screens, like a phone in portrait mode.

  • If the icon position is NavigationItemIconPosition.Start the icon will be displayed to the start of the label. This configuration is recommended for short navigation bars used in medium width screens, like a phone in landscape mode.

Parameters
selected: Boolean

whether this item is selected

onClick: () -> Unit

called when this item is clicked

icon: @Composable () -> Unit

icon for this item, typically an Icon

label: (@Composable () -> Unit)?

text label for this item

modifier: Modifier = Modifier

the Modifier to be applied to this item

enabled: Boolean = true

controls 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.

iconPosition: NavigationItemIconPosition = NavigationItemIconPosition.Top

the NavigationItemIconPosition for the icon

colors: NavigationItemColors = ShortNavigationBarItemDefaults.colors()

NavigationItemColors that will be used to resolve the colors used for this item in different states. See ShortNavigationBarItemDefaults.colors

interactionSource: MutableInteractionSource? = null

an 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.