Skip to content

Sheet ​

Bottom sheet: a scrim dims the page while a panel slides up from the bottom edge with a grab handle, optional title, and scrollable content. Use it for secondary tasks or contextual actions that don't warrant a full screen. Renders nothing when closed; place it at the end of a root Box so it overlays.

Import ​

kotlin
import io.github.heartcoolman.prism.ui.PrismSheet

Basic usage ​

kotlin
var open by remember { mutableStateOf(false) }

Box(modifier = Modifier.fillMaxSize()) {
    PrismButton(onClick = { open = true }) { Text("Open sheet") }

    PrismSheet(
        open = open,
        onClose = { open = false },
        title = "Sheet",
    ) {
        Text("Sheet body")
    }
}

Without a title ​

Omit title for a sheet that shows only the grab handle and content.

kotlin
PrismSheet(open = open, onClose = { open = false }) {
    Text("Content with no headline")
}

Disabling scrim dismissal ​

Set dismissOnScrim = false to require an explicit action to close (Escape/back is host-driven).

kotlin
PrismSheet(
    open = open,
    onClose = { open = false },
    title = "Confirm",
    dismissOnScrim = false,
) {
    Text("Tap a button to dismiss")
}

API ​

ParameterTypeDefaultDescription
openBoolean—Whether the sheet is visible. Renders nothing when false.
modifierModifierModifierModifier applied to the full-size overlay root.
onClose() -> Unit{}Called when the user requests dismissal (scrim click).
titleString?nullOptional headline shown above the content.
dismissOnScrimBooleantrueAllow closing by clicking the scrim.
content@Composable ColumnScope.() -> Unit—Sheet body content, laid out in a scrollable column.

Released under the MIT License.