Drawer
A panel that slides up from the bottom edge of the screen for a short task, with a swipe down to close.
When to use
- Show a short task or a set of choices from the bottom of a phone screen, where a thumb reaches it: filters, a share sheet, a quick form.
- Prefer
Popoverwithpresentation="auto"for a task that sits next to its trigger on a large screen and becomes a drawer on a phone. - Prefer
Sheetfor a panel from the left or right edge, such as a detail view. - Prefer
Dialogfor a task that needs a centered modal window.
Swipe to close
The panel follows a finger or a mouse down one to one. A release past a quarter of its height, or a flick, closes it. A shorter drag springs back. A drag up stretches the panel against rubber-band resistance, and it stays on the bottom edge. The scrim fades with the drag. A press on a field, a menu trigger, selected text, or scrolled content does not start a drag, and on a touch screen Drawer.Body scrolls with the finger. Under reduced motion the drawer appears and leaves in place.
Set dismissible={false} on Drawer.Root while the drawer holds unsaved work: a swipe springs back, and Escape, back, and the scrim do nothing. Drawer.Close and the owner still close it. The browser still closes it on a second back with no press in between, so that a page cannot trap the user, and onOpenChange reports that close.
Layering and the keyboard
Drawer runs on the browser's modal <dialog>: the page is inert and stops scrolling, and focus returns to the trigger on close. Focus moves to the <dialog>, not to its first field, so the on-screen keyboard stays closed until the user taps a field. When the keyboard opens, the panel rises above it. The scrim is a light dim with no blur.
Floats composed inside portal into the drawer. Toasts and OverlayPrompt content move into it. A Sandbar slides away while the drawer is open, so it does not cover the drawer's actions. See Stacking layers.
Composition
API Reference
Drawer.Root
The stateful root. It renders no element.
Drawer.Trigger
The button that opens the drawer. All props of a <button>, plus asChild.
Drawer.Content
The panel: a modal <dialog> that slides up from the bottom edge, with a grab handle at its top. All props of a <div>, plus onOpenAutoFocus, onCloseAutoFocus, onEscapeKeyDown, onPointerDownOutside, and onInteractOutside.
It sets the CSS variables --drawer-swipe (how far a drag has moved the panel, from 0 to 1) and --drawer-keyboard-inset (the height of the on-screen keyboard) on the <dialog>.
Drawer.Header
The top of the drawer, for its title and description. All props of a <div>.
Drawer.Title
The accessible name of the drawer. Renders an h2, or its child with asChild.
Drawer.Description
The accessible description of the drawer. All props of a <div>, plus asChild.
Drawer.Body
The scrolling middle of the drawer. All props of a <div>.
Drawer.Footer
The actions at the bottom of the drawer. All props of a <div>.
Drawer.Close
A button that closes the drawer. All props of a <button>, plus asChild.