Logobaseui-cn

Drawer

A panel that slides in from the edge of the screen.

Newoverlayinteractivemobile
Loading preview...

Installation

npx baseui-cn add drawer

Usage

import {
  Drawer,
  DrawerTrigger,
  DrawerContent,
  DrawerHeader,
  DrawerTitle,
  DrawerDescription,
  DrawerFooter,
  DrawerClose,
} from "@/components/ui/drawer"
<Drawer>
  <DrawerTrigger>Open Drawer</DrawerTrigger>
  <DrawerContent side="right">
    <DrawerHeader>
      <DrawerTitle>Settings</DrawerTitle>
      <DrawerDescription>Manage your preferences.</DrawerDescription>
    </DrawerHeader>
    <div className="flex-1 p-6">Content here.</div>
    <DrawerFooter>
      <DrawerClose>Close</DrawerClose>
    </DrawerFooter>
  </DrawerContent>
</Drawer>

Note: Built on Base UI Drawer (stable v1.3.0, March 2026). All other Base UI overlays — Select, Combobox, Tooltip — work correctly inside it, sharing the same portal system.

Examples

Default — slides in from the right.

Loading preview...

Bottom sheet

Use side="bottom" for a mobile bottom sheet.

Loading preview...

Left

Slides in from the left.

Loading preview...

With form

A drawer containing a form.

Loading preview...

Nested Select

Select inside a Drawer — no z-index issues.

Loading preview...

With toast

Perform an action inside the drawer and show a toast. Because Base UI uses a shared portal system, closing the toast does not close the drawer.

Loading preview...

API

DrawerContent

PropTypeDefaultDescription
side"top" | "bottom" | "left" | "right""right"Edge of the viewport the drawer slides in from

API Reference

See the Base UI Drawer documentation for the full API reference, including all props, data attributes, and CSS classes.