Drawer
An edge-attached modal panel with four placement choices.
An edge-attached modal panel with four placement choices.
Top/bottom Content fits its content by default. Its maximum is the available height, always bounded by the safe available region. Content.minExtent and maxExtent accept neutral lengths with unit logical, root-text, available or available-minus-root-text and a nonnegative finite value. A minimum above the safe cap is clamped. Left/right use fractional width, with a default maximum of 20 root-text units. An explicit maxExtent replaces that default; width, edge attachment and drag preview all use the same capped extent. For example, maxExtent={{ unit: 'logical', value: 480 }} gives a full-snap width of 480 logical units when space permits. The available unit is a fraction of the current safe width; valid minimum is ignored in fractional mode. Use maxExtent to size the sheet, rather than a separate CSS width.
The project composes Content as an overflow-y-auto scrollport. This differs from the fixed Shadcn/Neo reference wrappers’ overflow-hidden Content with an explicitly authored scrolling body. The long example keeps Close inside the same scrollport.
Root is the logical owner and still renders a wrapper. When placing it directly inside an application grid, use hostStyle={{ display: 'contents' }} on the React Root (or display: contents on the Web Component Root) to avoid an empty grid row. The neutral Root has no interactive role; Content, focus scope and naming retain their own semantic nodes. Keep application header/main regions outside the modal Content.
Root supports controlled open or uncontrolled defaultOpen. Disabled commands do not activate. Controlled close requests can be refused; drag preview then returns to the accepted owner state.
For top/bottom, omitted, null or empty snapPoints selects content-fit mode. Left/right keep fractional mode with a default point of one. A nonempty valid array selects explicit snaps: positive fractions up to one, sorted and deduplicated. snapPoint alone does not enable snapping. Explicit snap fractions use the full capped extent, not an implicit 85% multiplier. defaultSnapPoint is local; snapPoint with snapPointChange is owner-controlled. Invalid point arrays or length records on any edge are rejected, not converted to full height.
In content-fit mode Handle is a pointer-only, aria-hidden drag affordance, without keyboard resizing or an Enter/Space close action. Explicit snaps retain the named separator, arrows, Home/End and range values. Content.dragDismissible=false prevents drag dismissal; independent Close, Escape and outside dismissal retain their existing protocol. Interrupted gestures and rejected controlled requests restore the accepted presentation.
Runtime invalid extent updates expose extentValid=false, cancel Handle input and retain the last valid intent while current safety constraints still apply. Initial malformed input is rejected before presentation: Root keeps its logical open value, while Mask waits for one valid Content declaration. These examples use statically validated legal inputs. This draft does not claim arbitrary-input safety or native, compiler, packed-consumer or full Finf acceptance.
Long content
Section titled “Long content”Explicit half/full snaps
Section titled “Explicit half/full snaps”This example retains the explicit resizing interaction and announces committed changes.
Drawer is workspace source. There is no public proto-ui add target. Passing open selects controlled mode.
| Prop | Type | Default |
|---|---|---|
defaultOpen | boolean | false |
disabled | boolean | false |
a11yLabel | string | '' |
These props belong to Root. Mask accepts passthrough (false) plus the Transition props. Content defaults side to bottom and also accepts the Transition props. Handle defaults disabled to false and a11yLabel to Resize drawer. Trigger, Title, Description, Header, Footer, Close and AcceptedSide have no props.