← Back to Material 3 Compose
NavigationBar
Component
in
Material 3
. Since 1.0.0
Overview
Examples
Community Notes
@Composable
fun NavigationBarSample() {
var selectedItem by remember { mutableIntStateOf(0) }
val items = listOf("Songs", "Artists", "Playlists")
NavigationBar {
items.forEachIndexed { index, item ->
NavigationBarItem(
icon = { Icon(Icons.Filled.Favorite, contentDescription = item) },
label = { Text(item) },
selected = selectedItem == index,
onClick = { selectedItem = index }
)
}
}
}
Previous Component← MultiChoiceSegmentedButtonRow
Next ComponentNavigationBarItem →