Drawer
A panel that slides in from the edge of the screen over the page.
- Status
- ReadyBuild day 10 of 21
- Code
- In React
- Role
- Overlay
Usage
This demo is live, and the code below it is the same code, imports included. The component lives in src/ui of this repository and is not published to npm yet.
Filter transactions
Choose a date range and transaction type.
Pastes as editable layers. Shadows are not exported.
import { useState } from "react";
import { Button, Drawer } from "@/ui";
export default function DrawerDemo() {
const [open, setOpen] = useState<boolean>(false);
return (
<>
<Button onClick={() => setOpen(true)}>Filter transactions</Button>
<Drawer
open={open}
onClose={() => setOpen(false)}
title="Filter transactions"
footer={<Button onClick={() => setOpen(false)}>Save</Button>}
>
Drawer content
</Drawer>
</>
);
}Variants and states
Every specimen is the real component from src/ui, held in one state.
These are the panel on its own. The Drawer adds the scrim, the focus trap, and Escape.
Filter transactions
Choose a date range and transaction type.
Filter transactions
Choose a date range and transaction type.
Filter transactions
Choose a date range and transaction type.
Filter transactions
Choose a date range and transaction type.
Filter transactions
Filter transactions
Pastes as editable layers. Shadows are not exported.
Props
- open
- boolean · default none
- Required on Drawer.
- onClose
- () => void · default none
- Required on Drawer. Called for the close button, the scrim, and Escape.
- title
- string · default none
- Required. Names the dialog.
- description
- string · default none
- A line under the title.
- children
- ReactNode · default none
- The body.
- footer
- ReactNode · default none
- Footer buttons.
- side
- "right" | "left" | "bottom" | "top" · default "right"
- Where the panel comes from.
- size
- "sm" | "md" | "lg" · default "sm"
- Width 320, 400, or 720.
- DrawerPanel
- component · default none
- The panel without the dialog. Use it for documentation or your own layout.
Figma to code
Figma properties by their exact names from Naming, and the React prop that carries each one. The table covers the shared properties that bear on this component; the Figma file decides which of them its component exposes. None means there is no prop for it yet.
- 🧰 Type
- side
- right, left, bottom, or top.
- 📐 Size
- size
- sm, md, or lg.
- Title, Description
- title, description
- Same text.
- Show Close
- onClose
- On DrawerPanel, pass onClose to show the button.
- Show Button, Button Value
- footer
- Pass your own buttons.
Accessibility
What the code in src/ui does today, and what it leaves to you.
Keyboard
- Opening moves focus into the drawer. Tab stays inside. Escape closes it and focus returns to what opened it.
Screen readers
- A native dialog named by its title. The page behind is inert.
What you still need to do
- For a critical confirmation in the middle of the screen, use a modal, not a drawer.
- A drawer is only the panel and the scrim. The scrim at 40% is on the screen, as the design notes.
When to use
Filters, details, or a secondary task that keeps the page in context.
Do and don't
Do
- Close it with Escape, the close button, and a backdrop tap.
- Move focus into the drawer when it opens.
Don't
- Open a drawer from inside a drawer.
- Put a whole multi-step flow inside it.
Related
4 of 28 other molecules, same role and ready ones first.
- ModalA dialog that interrupts the current context to focus the user on a task.Ready
- TooltipA small popup that shows brief, supplementary information on hover or focus.Ready
- AccordionStacked sections that expand to reveal their content.Ready
- AlertA persistent, inline message that communicates important information.Ready
Status reflects the component tracker snapshot of 29 October 2026.