Skip to content

Drawer

A panel that slides in from the edge of the screen, with nested drawer support.

Installation

pnpm dlx shadcn@latest add @frontal-labs/drawer

Usage

import {
  Drawer,
  DrawerClose,
  DrawerContent,
  DrawerDescription,
  DrawerFooter,
  DrawerHeader,
  DrawerTitle,
  DrawerTrigger,
} from "@/components/ui/drawer";
<Drawer>
  <DrawerTrigger render={<Button variant="outline" />}>Open</DrawerTrigger>
  <DrawerContent>
    <DrawerHeader>
      <DrawerTitle>Drawer Title</DrawerTitle>
      <DrawerDescription>Drawer Description</DrawerDescription>
    </DrawerHeader>
    <div>Content</div>
    <DrawerFooter>
      <DrawerClose render={<Button variant="outline" />}>Close</DrawerClose>
    </DrawerFooter>
  </DrawerContent>
</Drawer>

API Reference

Built on Base UI's Dialog. Composition uses the render prop, not asChild — the same convention as Dialog, Alert Dialog and Sheet.

Drawer

Root component. All props from Base UI's Dialog.Root are supported, plus:

DrawerTrigger

Trigger button that opens the drawer. All props from Dialog.Trigger are supported.

DrawerContent

Container that displays the drawer content. Renders the portal and the overlay internally, so DrawerPortal and DrawerOverlay do not need to be composed by hand. Sizing, rounding and borders follow the root's direction.

All props from Dialog.Popup are supported, plus a dark prop — see Sheet's SheetContent for what it does.

DrawerHeader

Container for the drawer title and description. Centers its text for top and bottom drawers, and left-aligns it from the md breakpoint.

DrawerFooter

Footer section for action buttons. Pushes itself to the bottom of the drawer.

DrawerTitle

Title component. Styled wrapper for Dialog.Title.

DrawerDescription

Description component. Styled wrapper for Dialog.Description.

DrawerClose

Close button component. All props from Dialog.Close are supported.

DrawerPortal

Portal component for rendering outside the DOM hierarchy. Styled wrapper for Dialog.Portal. Rendered internally by DrawerContent.

DrawerOverlay

Backdrop component. Styled wrapper for Dialog.Backdrop. Rendered internally by DrawerContent.

Examples

Right side drawer

Directions

Scrollable content

Nested drawers

Nested side drawers

With a form

Mobile menu

Responsive dialog

Use Drawer on small screens and Dialog on larger ones to show the same content in a modal on desktop and a bottom sheet on mobile.