We just launched Compose Examples featuring over 150+ components! Check it out →

ShortNavigationBarItem

Common

Component in Material 3 Compose

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.

Last updated:

Installation

dependencies {
   implementation("androidx.compose.material3:material3:1.4.0-alpha02")
}

Overloads

@ExperimentalMaterial3ExpressiveApi
@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,
)

Parameters

namedescription
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.
iconPositionthe [NavigationItemIconPosition] for the icon
colors[NavigationItemColors] that will be used to resolve the colors used for this item in different states. See [ShortNavigationBarItemDefaults.colors]
interactionSourcean optional hoisted [MutableInteractionSource] for observing and emitting [Interaction]s 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.
by @alexstyl