androidx.compose.material3

ShortNavigationBarSince 1.9

Composable function

The short navigation bar is the Expressive version of the NavigationBar. It is shorter, and on medium-width screens it can put labels next to icons.

Use it the same way: in the bottomBar slot of a Scaffold, with one item per destination. You keep the selected index in a variable.

A short navigation barExpressive theme
A short navigation bar
var selected by remember { mutableIntStateOf(0) }
val items = listOf("Home" to Icons.Filled.Home, "Favorites" to Icons.Filled.Favorite, "Settings" to Icons.Filled.Settings)
ShortNavigationBar(Modifier.width(360.dp)) {
    items.forEachIndexed { index, (label, icon) ->
        ShortNavigationBarItem(
            selected = selected == index,
            onClick = { selected = index },
            icon = { Icon(icon, contentDescription = null) },
            label = { Text(label) },
        )
    }
}

Parameters

@Composable
fun ShortNavigationBar(
    modifier: Modifier = Modifier,
    containerColor: Color = ShortNavigationBarDefaults.containerColor,
    contentColor: Color = ShortNavigationBarDefaults.contentColor,
    windowInsets: WindowInsets = ShortNavigationBarDefaults.windowInsets,
    arrangement: ShortNavigationBarArrangement = ShortNavigationBarDefaults.arrangement,
    content: @Composable () -> Unit,
)

modifier: ModifierOptional

Default: Modifier

Changes size, padding, or position. See the Modifier guide.

containerColor: ColorOptional

Default: ShortNavigationBarDefaults.containerColor

The background color of the bar.

contentColor: ColorOptional

Default: ShortNavigationBarDefaults.contentColor

The default color for content inside the bar.

windowInsets: WindowInsetsOptional

Default: ShortNavigationBarDefaults.windowInsets

Space kept free for system bars. The default is usually right.

arrangement: ShortNavigationBarArrangementOptional

Default: ShortNavigationBarDefaults.arrangement

How the items fill the bar: spread over the full width, or centered.

content: @Composable () -> UnitRequired

The items. Add one ShortNavigationBarItem for each destination.

Parts

See also