Drawer
Edge sheet for secondary flows: slides from any side (sm/md/lg), with Dialog-grade modal semantics (portal, focus trap, Escape, focus restoration).
npx @slipstream-ui/cli@latest add drawerPlayground (interactive)
Bottom sheet
Common on mobile: an action sheet from the bottom edge.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| open | boolean | required | Whether the drawer is visible (controlled). |
| onOpenChange | (open: boolean) => void | — | Close requests (✕, Escape, backdrop, your own triggers). |
| onClose | () => void | — | Close-request alias for onOpenChange(false); used when only a close handler is passed. |
| title | string | required | Accessible dialog name rendered as the header title. |
| description | string | — | Supporting line under the title (wired via aria-describedby). |
| side | 'left' | 'right' | 'top' | 'bottom' | 'right' | Edge the drawer slides from. |
| size | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'md' | Preset extent along the side axis (width for sides, height for top/bottom). |
| width | number | string | — | Custom extent for left/right drawers: pixels (520) or any CSS length ("70vw"). Overrides size. |
| height | number | string | — | Custom extent for top/bottom drawers - pixels (320) or any CSS length ("60vh"). Overrides size. |
| resizable | boolean | false | Drag the inner edge to resize a left/right drawer. Arrow keys nudge 16px, Shift+Arrow 64px, Home/End jump to the bounds. |
| minWidth | number | 240 | Lower width bound in pixels while resizable. |
| maxWidth | number | 960 | Upper width bound in pixels while resizable. |
| defaultWidth | number | — | Initial width in pixels while resizable; defaults to the size preset. |
| onWidthChange | (width: number) => void | — | Fired with the next width in pixels when a resize commits. |
| resizeLabel | string | 'Resize drawer' | Accessible label for the resize handle. |
| closeOnBackdrop | boolean | true | Clicking the backdrop closes the drawer. |
| showClose | boolean | true | Hide the header ✕ (Escape and backdrop still close). |
| initialFocusRef | RefObject<HTMLElement | null> | — | Element focused on open (defaults to first focusable). |
| animate | boolean | false | Slide the panel in from its edge and out on close (needs tailwindcss-animate). |
Accessibility
- role=dialog + aria-modal, labelled by title, described by description; portals to body.
- Focus moves in on open, Tab/Shift+Tab are trapped, focus restores to the opener on close.
- Escape closes; backdrop click closes when closeOnBackdrop (default).
- Body scrolls internally: the page behind never moves.
Browser support
| Browser | Tested versions |
|---|---|
| Chrome | 111+ (Mar 2023) |
| Edge | 111+ (Mar 2023) |
| Firefox | 121+ (Dec 2023) |
| Safari | 17.2+: macOS & iOS (Dec 2023) |
Slipstream components rely only on CSS custom properties, Flexbox/Grid, and ARIA, the everyday baseline of the last two years of evergreen releases. Anything newer is progressive enhancement: unsupported browsers keep full functionality with static behavior instead of animations.