Drawer
A panel from the side, for detail without leaving the list behind. It slides on a transform, so opening one does not reflow the page underneath it.
Reach for it
A long or secondary task beside the page: a detail panel, a filter set, a record.
Not for
A short decision. A Dialog is less to dismiss.
Sides and sizes
Right is the default and reads as detail about the row you clicked. Left suits navigation. The size is a step rather than a width, so drawers across a product stay the same handful of widths.
Held open while a write settles
A controlled drawer that ignores every request to close while its write is in flight. The close control is disabled rather than hidden, so the reader can see there is a way out and that it is not available yet.
API reference
Drawer
Also takes the props of Base UI Dialog Root.
DrawerTrigger
Also takes the props of Base UI Dialog Trigger.
DrawerClose
Also takes the props of Base UI Dialog Close.
DrawerContent
| Prop | Type | Default | Description |
|---|---|---|---|
| title* | string | - | |
| children* | ReactNode | - | |
| closeLabel* | string | - | Label for the close control. Passed in because the package ships no copy. |
| data-testid | string | - | Names the element for a test. Never rendered, never announced. |
| side | 'right' | 'left' | right | |
| density | 'flush' | 'compact' | 'comfortable' | comfortable | How much room the body gives its content. A density rather than a padding: `flush` is for a body that owns its own edges, a tab strip or a table that should reach the sides of the panel. Named to match Card, so one word covers the same decision wherever it is made. The top edge is padded like the others. It was not, on the reasoning that the header already set the distance, but the header's padding sits above its own bottom border: below that border there was nothing, so the first field in every drawer touched the rule under the title. |
| // The donors' scale was 1 to 5, which says nothing about which one a // 500px form belongs in. Same widths, names a caller can choose from. size | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge' | - | |
| description | string | - | Announced with the title. Use for what the drawer is for. |
| isTitleHidden | boolean | - | |
| actions | ReactNode | - | Header controls, placed before the close button. A prop rather than children because the drawer draws the header row and decides where these sit in it. The body and the footer are children, because their order is yours. |
| isCloseDisabled | boolean | - | Renders the close control disabled, for a drawer held open while a write it started settles. Disabled rather than hidden, so the reader can see there is a way out and that it is not available yet. This only stops the button: Escape and a click outside still ask to close, and a controlled `Drawer` holds itself open by not acting on `onOpenChange(false)`. |
DrawerBody
| Prop | Type | Default | Description |
|---|---|---|---|
| children* | ReactNode | - |
DrawerFooter
| Prop | Type | Default | Description |
|---|---|---|---|
| children* | ReactNode | - |