Drawer
An edge-attached modal drawer supporting four sides, constrained sizing, drag dismissal, and explicit snap points.
Base Drawer renders a modal sheet attached to the top, bottom, left, or right edge of the viewport, with content-fit or fractional sizing, drag-to-dismiss, and multi-stop snap points.
Preview
Section titled “Preview” Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
Long content
Section titled “Long content” Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
Explicit half/full snaps
Section titled “Explicit half/full snaps” Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
Installation
Section titled “Installation”Available starting in 0.3.0-rc.1 and later releases.
Sizing and scroll layout
Section titled “Sizing and scroll layout”top/bottomdrawers size to their content by default within the safe available height;left/rightdrawers use fractional width (default max of 20root-textunits).- Configure drawer dimensions via
ContentminExtentandmaxExtent(rather than standalone CSS width/height) using'logical','root-text','available', or'available-minus-root-text'units—for examplemaxExtent={{ unit: 'logical', value: 480 }}. Contentacts as anoverflow-y-autoscroll container so long content remains scrollable inside the sheet.- When placing
Rootdirectly inside a CSS grid, sethostStyle={{ display: 'contents' }}in React (ordisplay: contentson Web Components) to avoid an empty grid track.
Drag dismissal and snap points
Section titled “Drag dismissal and snap points”- Passing a non-empty array of fractions in
(0, 1]tosnapPointsenables multi-stop snapping (automatically sorted and deduplicated). OmittingsnapPointsontop/bottomkeeps content-fit sizing. - Control snap positions via
defaultSnapPoint(uncontrolled) orsnapPoint+snapPointChange(controlled). Explicit snap mode givesHandlenamed separator semantics with arrow keys andHome/End; content-fit mode keepsHandleas a pointer drag affordance. - Set
dragDismissible={false}onContentto disable drag dismissal while retainingClose,Escape, and outside-click dismissal. - Pass
openfor controlled mode: interrupted drags or rejected close requests smoothly return to the current committed state.
Root Props
Section titled “Root Props”Passing open selects controlled mode.
| Prop | Type | Default |
|---|---|---|
open | boolean | — |
defaultOpen | boolean | false |
disabled | boolean | false |
a11yLabel | string | '' |
Other parts
Section titled “Other parts”- Mask:
passthroughdefaults tofalse, plus Transition props. - Content:
sidedefaults to'bottom', plusminExtent,maxExtent,snapPoints,snapPoint,defaultSnapPoint,dragDismissible, and Transition props. - Handle:
disableddefaults tofalse,a11yLabeldefaults to'Resize drawer'. - Trigger, Title, Description, Header, Footer, Close, AcceptedSide: no props.