Skip to Content
Columbus

Drawer

A panel that slides in from the edge of the screen with swipe gestures, snap points, and nested drawer support.

Installation

pnpm dlx shadcn@latest add @columbus/drawer

Usage

import {
  Drawer,
  DrawerClose,
  DrawerDescription,
  DrawerFooter,
  DrawerHeader,
  DrawerPanel,
  DrawerPopup,
  DrawerTitle,
  DrawerTrigger,
} from "@/components/ui/drawer";

<Drawer>
  <DrawerTrigger render={<Button variant="outline" />}>Open</DrawerTrigger>
  <DrawerPopup showBar>
    <DrawerHeader>
      <DrawerTitle>Title</DrawerTitle>
      <DrawerDescription>Description</DrawerDescription>
    </DrawerHeader>
    <DrawerPanel>Content</DrawerPanel>
    <DrawerFooter>
      <DrawerClose render={<Button variant="ghost" />}>Close</DrawerClose>
    </DrawerFooter>
  </DrawerPopup>
</Drawer>;

Always include a DrawerTitle. Screen readers use it as the drawer's name. If it shouldn't be visible, hide the header with className="sr-only".

Positions

position on Drawer sets the edge the drawer opens from and the direction you swipe to close it.

Snap points

snapPoints lets a bottom drawer rest at set heights. Use pixel strings like "320px" or fractions of the screen like 0.5; 1 is full height.

Action menu

The DrawerMenu parts look like Menu items but are sized for touch. Wrap an item in DrawerClose to close the drawer when it's picked. DrawerMenuTrigger opens a nested drawer.

API reference

Built on Base UI Drawer. Every part accepts the props of its Base UI counterpart, including snapPoints, modal, and open on Drawer.

Drawer

Prop

Type

DrawerPopup

Prop

Type

DrawerHeader, DrawerFooter, DrawerPanel

Prop

Type

DrawerMenuItem and DrawerMenuCheckboxItem

Prop

Type

On this page