Scaffold

The basic screen layout: top bar, bottom bar, FAB, snackbars and content.

When to use

Scaffold places the app bars, the FAB and the snackbar host around your content and reports the padding the content needs. Always apply that padding, otherwise content hides behind the bars.

For screens that adapt to the window size, combine it with the adaptive scaffolds and a navigation rail.

Playground

The interactive page has a playground with live property controls for this component and generated code.

Examples

Top bar and FAB

Scaffold(
    modifier = Modifier.fillMaxWidth().height(320.dp),
    topBar = { CenterAlignedTopAppBar(title = { Text("Library") }) },
    floatingActionButton = {
        FloatingActionButton(onClick = {}) { Icon(Icons.Rounded.Add, contentDescription = "Add") }
    },
) { padding ->
    LazyColumn(contentPadding = padding) {
        items((1..20).toList()) { ListItem(headlineContent = { Text("Item $it") }) }
    }
}

Parameters

NameTypeDefaultDescription
topBar / bottomBar@Composable () -> Unit{}App bar slots.
floatingActionButton@Composable () -> Unit{}The FAB slot.
floatingActionButtonPositionFabPositionFabPosition.EndStart, End, Center or EndOverlay.
snackbarHost@Composable () -> Unit{}Where snackbars appear.
content@Composable (PaddingValues) -> UnitReceives the inner padding.

Guidelines

Do:

Don't:

Accessibility

Related components