Skip to content

BottomSheet

BottomSheetHandle presents application-defined content in a theme-shaped, bottom-aligned modal surface.

auto sheets = UseBottomSheet();
Button("Share").OnClick([sheets] {
sheets.Show([](BottomSheetContext sheet) {
return Column {
Text("Share with", TextRole::Title),
Button("Copy link").OnClick([sheet] {
CopyLink();
sheet.Dismiss();
}),
}.With(Padding(24.0F), Spacing(12.0F));
});
})

The factory may take no context or receive BottomSheetContext. BottomSheetOptions controls cancel and outside-press dismissal. The handle returns a LayerId and can dismiss it explicitly.

Use the context-aware factory when an action completes the sheet’s task. An outside or platform-cancel request follows BottomSheetOptions rather than bypassing application policy.

BottomSheetStyle controls scrim, surface, top corners, shadow, drag-handle geometry, maximum width, and enter/exit animation. Content uses the Environment captured by UseBottomSheet().

  • UseBottomSheet() -> BottomSheetHandle.
  • Show(ViewFactory, BottomSheetOptions = {}).
  • Show(BottomSheetFactory, BottomSheetOptions = {}) and bound-argument template.
  • Dismiss(LayerId).
  • BottomSheetContext::Id() and Dismiss().
  • BottomSheetOptions and BottomSheetStyle.

See Dialog for centered modal presentation.

The sheet supplies a bottom-aligned surface rather than the standard title/message/actions of an alert. Your factory owns content padding, scrolling, and action layout. Bound-argument calls such as sheets.Show(ShareContent, document) retain copyable arguments; a context-aware function receives BottomSheetContext before those arguments.

Both outside-press and cancel dismissal default to true. on_dismiss_request, if provided, handles a request instead of automatic dismissal. Explicit Dismiss(id) and context.Dismiss() return a boolean and are safe for a stale/exiting layer. They do not call the request handler as a completion notification. There is no BottomSheetHandle::Update overload; use State read by the content for live changes.

scrim, background, shadow, and corner_radii define the barrier and bottom surface. maximum_width caps the sheet on large windows. drag_handle, drag_handle_size, and drag_handle_padding control the visible handle; transparent handle color hides it. enter and exit are independent AnimationSpec values, unlike Dialog’s optional PresentationMotion.

Do not infer configurable detents, nested scrolling handoff, or a persistent side panel from the handle’s appearance. Those are not constructor options on this API. Use DrawerLayout for responsive side content.