androidx.compose.material3

AppBarRowSince 1.9

Composable function

An app bar row lays out actions for an app bar or toolbar. Actions that don't fit, or go past maxItemCount, move into an overflow menu behind a "more" button.

Use it in the actions slot of a TopAppBar, or in a toolbar. AppBarColumn does the same top to bottom.

Like ButtonGroup, it takes items, not composables: add them with clickableItem, toggleableItem and customItem. Each item needs a label, shown in the menu.

Actions that move into a menu when there is no roomExpressive theme
Actions that move into a menu when there is no room
AppBarRow(maxItemCount = 3) {
    clickableItem(onClick = {}, icon = { Icon(Icons.Filled.Edit, null) }, label = "Edit")
    clickableItem(onClick = {}, icon = { Icon(Icons.Filled.Share, null) }, label = "Share")
    clickableItem(onClick = {}, icon = { Icon(Icons.Filled.Favorite, null) }, label = "Favorite")
    clickableItem(onClick = {}, icon = { Icon(Icons.Filled.Settings, null) }, label = "Settings")
}

Parameters

@Composable
fun AppBarRow(
    modifier: Modifier = Modifier,
    overflowIndicator: @Composable (AppBarMenuState) -> Unit = { menuState -> AppBarOverflowIndicator(menuState) },
    maxItemCount: Int = Int.MAX_VALUE,
    content: AppBarRowScope.() -> Unit,
)

modifier: ModifierOptional

Default: Modifier

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

overflowIndicator: @Composable (AppBarMenuState) -> UnitOptional

Default: { menuState -> AppBarOverflowIndicator(menuState) }

The button that opens the menu. Default: AppBarOverflowIndicator, a "more" icon button.

maxItemCount: IntOptional

Default: Int.MAX_VALUE

The most items shown. The rest go into the menu. Default: as many as fit.

content: AppBarRowScope.() -> UnitRequired

The items. Add them with clickableItem(onClick, icon, label), toggleableItem(...) or customItem(...).

Types and parts