GPUI Deck

Drawer

Edge placement, drag-to-dismiss and optional vertical snap heights over Dialog.

Rendered by GPUI’s web backend from the real component. Requires a browser with WebGPU.

DrawerState composes one DialogState. Construct it with new(window, cx) or adopt a configured Dialog through with_dialog; mount that state in one Drawer. open/close, initial focus, containment, Escape, backdrop dismissal and return focus remain owned by Dialog. The state forwards DialogEvent and exposes dialog() for ordinary DialogClose controls.

The default drawer opens at the bottom. Set .side(Placement::Left) on DrawerState before mounting to attach it to another edge. All four edges support outward dragging from the supplied .handle(...). The body keeps its own scrolling and editing. Without snap points, dragging a third of the panel towards its edge closes the drawer. A shorter drag returns it to rest.

For a top or bottom drawer, .snap_points([0.5, 0.85]) starts at half the window height. Dragging the handle resizes the panel and releasing it settles at the nearest height, including closed. Supply strictly increasing fractions above zero and up to one. The points control the panel height as the window resizes. Use snap_index() and set_snap_index(index, window, cx) for a keyboard-accessible size button, as in the catalogue's session review. Window deactivation cancels a drag. Reopening retains the last resting height.