Skip to content

Drawer

Drawer is a bottom-anchored panel built on vaul. It slides up from the bottom edge, shows a drag handle, and (by default) scales the page behind it back to signal depth. Reach for it on touch-first layouts when you want a draggable, dismissible surface for a quick task or set of controls.

Live demo

The interactive story below runs from the deployed Storybook.

Usage

Source: drawer.tsx

import {
Drawer,
DrawerTrigger,
DrawerContent,
DrawerHeader,
DrawerTitle,
DrawerDescription,
DrawerFooter,
DrawerClose,
Button,
} from "@beacon/design-system";
<Drawer>
<DrawerTrigger asChild>
<Button variant="outline">Open Drawer</Button>
</DrawerTrigger>
<DrawerContent>
<div className="mx-auto w-full max-w-sm">
<DrawerHeader>
<DrawerTitle>Move Goal</DrawerTitle>
<DrawerDescription>Set your daily activity goal.</DrawerDescription>
</DrawerHeader>
<DrawerFooter>
<Button>Submit</Button>
<DrawerClose asChild>
<Button variant="outline">Cancel</Button>
</DrawerClose>
</DrawerFooter>
</div>
</DrawerContent>
</Drawer>

Parts

PartRole
DrawerRoot container. Accepts shouldScaleBackground (defaults to true) plus the vaul root props such as open and onOpenChange.
DrawerTriggerElement that opens the drawer. Use asChild to wrap your own button.
DrawerContentThe sliding bottom panel. Renders the overlay and a drag handle automatically.
DrawerHeaderLayout wrapper for the title and description.
DrawerTitleAccessible heading announced to screen readers.
DrawerDescriptionSupporting text under the title.
DrawerFooterAction stack pinned to the bottom of the panel.
DrawerCloseDismisses the drawer. Use asChild to make a custom element close it.
DrawerPortalRenders content into a portal at the document root.
DrawerOverlayThe backdrop scrim. Included automatically by DrawerContent.

When to use

  • Touch-first layouts where a draggable, dismissible bottom surface feels native.
  • Quick tasks or control sets that benefit from the scaled-back background depth cue.

Do not use a Drawer for desktop side panels anchored to the left or right edge: use a Sheet with the matching side instead. For a centered, page-blocking task use a Dialog.