Components / Overlays

Bottom Sheet

Open the bottom sheet, then drag or use the button to dismiss it.

CupertinoBottomSheetScaffold View source ↗

Playground

Live Compose · Wasm
Preview

Click or drag inside the preview to try it out.

Properties

Usage example

Kotlin code for the current playground settings.

Example.kt
kotlin
import androidx.compose.runtime.*import androidx.compose.foundation.layout.*import androidx.compose.ui.Modifierimport androidx.compose.ui.unit.dpimport zone.ien.hig.*import zone.ien.hig.theme.*import androidx.compose.ui.Alignmentimport kotlinx.coroutines.launchimport androidx.compose.foundation.Imageimport androidx.compose.ui.layout.ContentScaleimport org.jetbrains.compose.resources.painterResourceimport zone.ien.hig.composeapp.generated.resources.Resimport zone.ien.hig.composeapp.generated.resources.glass_landscapeimport androidx.compose.foundation.backgroundimport com.kyant.backdrop.backdrops.rememberLayerBackdropimport com.kyant.backdrop.backdrops.layerBackdropimport androidx.compose.ui.graphics.Color
@OptIn(ExperimentalCupertinoApi::class)@Composablefun Example() { CupertinoTheme(colorScheme = lightColorScheme(accent = Color(0xFF007AFF))) { val backdrop = rememberLayerBackdrop() Box(Modifier.fillMaxSize()) { Image(painterResource(Res.drawable.glass_landscape), contentDescription = null, modifier = Modifier.matchParentSize().layerBackdrop(backdrop), contentScale = ContentScale.Crop) Column(Modifier.fillMaxSize(), verticalArrangement = Arrangement.spacedBy(16.dp, Alignment.CenterVertically)) { val state = rememberCupertinoBottomSheetScaffoldState() val scope = rememberCoroutineScope() CupertinoBottomSheetScaffold( colors = CupertinoBottomSheetScaffoldDefaults.colors(containerColor = Color.Transparent), scaffoldState = state, sheetContent = { CupertinoBottomSheetContent { padding -> Column(Modifier.padding(padding).padding(24.dp)) { CupertinoText("Open bottom sheet") CupertinoButton(onClick = { scope.launch { state.bottomSheetState.hide() } }) { CupertinoText("Close") } } } }, ) { padding -> Box(Modifier.fillMaxSize().padding(padding), contentAlignment = Alignment.Center) { Image(painterResource(Res.drawable.glass_landscape), contentDescription = null, modifier = Modifier.matchParentSize().layerBackdrop(backdrop), contentScale = ContentScale.Crop) CupertinoButton(onClick = { scope.launch { state.bottomSheetState.show() } }) { CupertinoText("Open bottom sheet") } } } } } }}

Run examples inside CupertinoTheme. For components using backdrop, attach layerBackdrop to the background content.

The background uses the sample app's glass_landscape resource. Replace it with an image from your project.