API and Development
Drawer from @prepared911/ui-drawer renders a sliding panel anchored to the left or right of the viewport, with global open state via useDrawerStore, optional portal rendering, and composition helpers (DrawerHeader, DrawerContent, DrawerFooter). Use this page for API reference and a single interactive preview; Storybook holds the full set of examples.
A portaled drawer with header, scrollable list body, one expandable section, and a footer—similar to detail panels when reviewing historical (archived) incidents in dispatch.
Name | Type | Default | Description |
|---|---|---|---|
|
| — | — |
|
|
| — |
|
|
| — |
|
|
| When |
|
| — | Accessible label for the default header close button when |
|
|
| — |
|
|
| When |
|
|
| Maximum width while resizing. |
|
|
| Minimum width while resizing. |
|
| — | — |
|
| — | Called when Escape is pressed while the drawer is open.
Call |
|
| — | Called after the exit animation finishes (e.g. clear parent state that would unmount this drawer). |
|
| — | — |
|
| — | — |
|
|
| — |
|
|
| Shows a drag handle on the inner edge so users can resize between
|
|
| — | When set, renders a default |
|
|
| Initial / non-resized width. |
|
|
| Z-index level for the drawer container. If not set, defaults to Overlay. Use |
Set resizable to show a drag handle on the inner edge. Out of the box the width clamps between 40rem (DRAWER_DEFAULT_MIN_WIDTH) and 60rem (DRAWER_DEFAULT_MAX_WIDTH); override with minWidth / maxWidth / width as needed. Values may be rem, px, or vw/dvw.
Pass excludeFromLayout when a drawer should keep its own open state but must not participate in shared layout math (anyDrawerOpen, getOpenDrawerWidth, getAnchoredOpenDrawerWidth) or width sync. Use this for overlays such as the staff panel that sit above the app without padding main content.
DrawerNav renders fixed segmented navigation between DrawerHeader and DrawerContent. Set collapseUnselectedLabels to keep the active item label open while collapsing inactive items to their icons. Collapsible DrawerNavItem entries must provide both icon and aria-label.
Name | Type | Default | Description |
|---|---|---|---|
|
| — | Controlled selected segment value. |
|
| — | Initial uncontrolled segment value. |
|
| — | Runs when selection changes. |
|
|
| Expands segments evenly across the nav width. |
|
|
| Collapses inactive labels to their icons. |
|
| — | Controls pinned to the right of the nav. |
|
|
| Renders the nav bottom border. |
|
|
| Merges compact nav chrome with the preceding header. |
|
|
| Enables horizontal drag-to-scroll for overflowing items. |
Interactive examples and edge cases for this component are in Storybook.