androidx.compose.material3
Scaffold
Composable function
A scaffold lays out a whole screen. You give it the parts, and it places them: the top bar at the top, the bottom bar at the bottom, the FAB above the bottom bar, and your content in between.
Use one Scaffold per screen.

var selected by remember { mutableIntStateOf(0) }
Scaffold(
modifier = Modifier.size(360.dp, 560.dp),
topBar = { TopAppBar(title = { Text("Photos") }) },
bottomBar = {
NavigationBar {
NavigationBarItem(selected == 0, { selected = 0 }, { Icon(Icons.Filled.Home, null) }, label = { Text("Home") })
NavigationBarItem(selected == 1, { selected = 1 }, { Icon(Icons.Filled.Favorite, null) }, label = { Text("Favorites") })
}
},
floatingActionButton = {
FloatingActionButton(onClick = {}) { Icon(Icons.Filled.Add, "Add photo") }
},
) { innerPadding ->
// Use innerPadding, or the content goes under the bars.
Column(Modifier.padding(innerPadding).padding(16.dp)) {
Text("Your photos appear here.")
}
}
Parameters
@Composable
fun Scaffold(
modifier: Modifier = Modifier,
topBar: @Composable () -> Unit = {},
bottomBar: @Composable () -> Unit = {},
snackbarHost: @Composable () -> Unit = {},
floatingActionButton: @Composable () -> Unit = {},
floatingActionButtonPosition: FabPosition = FabPosition.End,
containerColor: Color = MaterialTheme.colorScheme.background,
contentColor: Color = contentColorFor(containerColor),
contentWindowInsets: WindowInsets = ScaffoldDefaults.contentWindowInsets,
content: @Composable (PaddingValues) -> Unit,
)
modifier: ModifierOptional
modifier: ModifierOptionalDefault: Modifier
Changes size, padding, or position of the scaffold. See the Modifier guide.
Add Modifier.nestedScroll(...) here when the top bar has a scrollBehavior.
topBar: @Composable () -> UnitOptional
topBar: @Composable () -> UnitOptionalDefault: {}
The bar at the top. Usually a TopAppBar.
bottomBar: @Composable () -> UnitOptional
bottomBar: @Composable () -> UnitOptionalDefault: {}
The bar at the bottom. Usually a NavigationBar or a BottomAppBar.
snackbarHost: @Composable () -> UnitOptional
snackbarHost: @Composable () -> UnitOptionalDefault: {}
Where snackbars appear. Usually SnackbarHost(snackbarHostState).
Show a snackbar with snackbarHostState.showSnackbar("Saved") from a coroutine.
floatingActionButton: @Composable () -> UnitOptional
floatingActionButton: @Composable () -> UnitOptionalDefault: {}
The main action of the screen. Usually a FloatingActionButton.
floatingActionButtonPosition: FabPositionOptional
floatingActionButtonPosition: FabPositionOptionalDefault: FabPosition.End
Where the FAB sits: FabPosition.End (default), Start, Center, or EndOverlay (over the bottom bar).
containerColor: ColorOptional
containerColor: ColorOptionalDefault: MaterialTheme.colorScheme.background
The background color of the screen. Default: the theme's background.
contentColor: ColorOptional
contentColor: ColorOptionalDefault: contentColorFor(containerColor)
The default color for text and icons in the content.
contentWindowInsets: WindowInsetsOptional
contentWindowInsets: WindowInsetsOptionalDefault: ScaffoldDefaults.contentWindowInsets
Space kept free for system bars around the content. The default is usually right.
content: @Composable (PaddingValues) -> UnitRequired
content: @Composable (PaddingValues) -> UnitRequiredThe main content of the screen.
It receives PaddingValues: the space taken by the bars. Apply it with Modifier.padding(innerPadding), or your content goes under the bars.
For a list, pass it as contentPadding instead, so items can scroll under the bars.
See also
ScaffoldDefaults: default values and helper functions forScaffold.