Drawer
drawerA bottom sheet on the Base UI dialog, so it keeps the focus trap, Esc and focus return. Drag it down by the handle or header and it follows your finger, then springs back or closes when pulled past a third of its height or flicked.
"use client";
import { useState } from "react";
import { Button } from "@/components/forme/button/button";
import { Slider } from "@/components/forme/slider/slider";
import { Switch } from "@/components/forme/switch/switch";
import {
Drawer,
DrawerBody,
DrawerClose,
DrawerContent,
DrawerDescription,
DrawerFooter,
DrawerHeader,
DrawerTitle,
DrawerTrigger,
} from "@/components/forme/drawer/drawer";
export function DrawerDemo() {
const [open, setOpen] = useState(false);
return (
<Drawer open={open} onOpenChange={setOpen}>
<DrawerTrigger asChild>
<Button variant="secondary">Filters</Button>
</DrawerTrigger>
<DrawerContent>
<DrawerHeader>
<DrawerTitle>Filter listings</DrawerTitle>
<DrawerDescription>Drag the sheet down, or press Esc, to close it.</DrawerDescription>
</DrawerHeader>
<DrawerBody className="flex flex-col gap-6">
<Slider
label="Price per night"
defaultValue={[80, 240]}
min={0}
max={500}
step={5}
format={{ style: "currency", currency: "USD", maximumFractionDigits: 0 }}
thumbLabels={["Minimum price", "Maximum price"]}
/>
<div className="flex flex-col gap-3">
<Switch label="Free cancellation" defaultChecked />
<Switch label="Self check-in" />
<Switch label="Pets allowed" />
</div>
</DrawerBody>
<DrawerFooter>
<DrawerClose asChild>
<Button variant="secondary">Reset</Button>
</DrawerClose>
<Button onClick={() => setOpen(false)}>Show 128 stays</Button>
</DrawerFooter>
</DrawerContent>
</Drawer>
);
}Install
Adds the component, its registry dependencies, and the token stylesheet you import once.
Usage
import {
Drawer, DrawerBody, DrawerContent, DrawerHeader, DrawerTitle, DrawerTrigger,
} from "@/components/forme/drawer/drawer";
<Drawer>
<DrawerTrigger asChild>
<Button variant="secondary">Filters</Button>
</DrawerTrigger>
<DrawerContent>
<DrawerHeader>
<DrawerTitle>Filter listings</DrawerTitle>
</DrawerHeader>
<DrawerBody>…</DrawerBody>
</DrawerContent>
</Drawer>When to use
Reach for it
- Panels on a phone: filters, a share sheet, the details of a row.
Use something else
- Desktop layouts where a side panel or a
Dialogreads better than a sheet from the bottom.
API reference
Read from the source, so it is the API of the file you install. A prop marked * is required.
DrawerTrigger
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — |
Also takes every prop of Base UI Dialog.Trigger.
DrawerClose
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — |
Also takes every prop of Base UI Dialog.Close.
The other parts
DrawerTakes Base UIDialog.RootDrawerContentTakes Base UIDialog.PopupDrawerHeaderTakes<div>attributesDrawerBodyTakes<div>attributesDrawerFooterTakes<div>attributesDrawerTitleTakes Base UIDialog.TitleDrawerDescriptionTakes Base UIDialog.Description
Accessibility
- It is a Base UI dialog underneath: focus is trapped, the page is inert, Esc closes it and focus returns to the trigger.
Motion
- Drag the handle or header and the sheet follows the finger; past a third of its height, or on a quick flick, it closes.
- The drag writes a transform straight to the element, so it keeps up with the pointer without re-rendering.
Responsive behaviour
- The footer's buttons stack on a phone and sit in a row from
sm.
Related


Dialog
A modal built on the Base UI primitive, so the focus trap, the inert background, Esc to close and the return of focus all come from one well tested place. The backdrop fades and the panel scales in, both in and out, and everything comes from the foundation tokens.
overlays

Dropdown
A menu of actions revealed from a trigger. Grouped, with labels, a destructive variant, checkbox items, and full keyboard and typeahead support from the Base UI menu primitive — Forme adds only the surface and the motion.
overlays

Lightbox
A photo gallery whose thumbnails fly into a full-screen viewer and back again. Arrow keys, a thumbnail strip and swipe move between photos, and it is a Base UI dialog underneath, so focus is trapped and returns to the thumbnail you opened.
overlays