Skip to main content

sheet

Function sheet 

Source
pub fn sheet(
    id: impl Into<SharedString>,
    viewport: Size<Pixels>,
    side: Side,
    extent: Pixels,
    content: AnyElement,
    closing: Option<Instant>,
    on_dismiss: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static,
) -> AnyElement
Expand description

A panel over a dim scrim — modal pinned to an edge. It slides in over motion::DIALOG_IN and, once the caller’s Popup enters its exit phase, back out over motion::MENU_OUT — which it must, because Popup::finish_close reaps on that spec’s span.

extent is measured across the edge the sheet is pinned to: a width on Side::Left and Side::Right, a height on Side::Bottom. The other axis always spans the viewport.

on_dismiss is the scrim click. Unlike the anchored menus, dismissal cannot be the caller’s .on_mouse_down_out: the scrim lives inside this deferred layer, so nothing outside can reach it.

The slide is written here rather than as a motion helper because only the spec is motion — which inset carries it is layout, and it differs per side.