Drawer
Bottom sheet you can fling closed. Drag past a threshold or flick down, and it rubber-bands at the top.
- Category: Overlays
- Licence: Free, MIT
- Built with: React 19, Tailwind CSS 4, Motion
- Dependencies: motion, clsx, tailwind-merge
Examples
Drawer
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | — | |
onOpenChange | (open: boolean) => void | — | |
title | ReactNode | — | |
children | ReactNode | — |
About Drawer
Drawer is a bottom sheet you can drag and fling closed. Pull past a threshold or flick down and it goes; drag up and it rubber-bands. It feels like a native mobile sheet.
Drawer is an overlay component for React 19, styled with Tailwind CSS 4 and animated with Motion. It drops into Next.js, Vite, Remix or Astro through the shadcn CLI as a single file you own.
When to use Drawer
- Mobile menus and actions.
- Filters on small screens.
- Detail views over lists.
- Share sheets.
How it works
Drag is constrained vertically with elastic resistance above the top. Velocity or distance decides whether it closes, and it is a modal dialog for focus and screen readers.
It traps and returns focus correctly, closes on Escape, and is announced to screen readers with the right dialog or menu role. With prefers-reduced-motion on, it holds still or settles instantly instead of animating.
Customizing Drawer
Every prop is documented in the API reference above with its type and default. The ones you will reach for first are listed here.
The Customize panel next to the preview lets you change title, description live, and the Code tab updates to match, so the snippet you copy already carries your values.
- open (boolean).
- title (ReactNode).
Goes well with Drawer
These overlays pieces share its tokens and motion language, so they sit together on one page without clashing.
- Tooltip: An animated React tooltip that springs from its trigger, with instant neighbours
- Popover: An animated React popover that scales from its trigger and returns focus on close
- Dialog: An animated React dialog on the native dialog element, with blur and scale transitions
- Toast: Animated React toasts that stack, fan out on hover and swipe away
- Sheet: An animated React side sheet on the native dialog element that you can fling closed
Install Drawer
npx shadcn@latest add https://charcoalui.com/r/drawer.jsonDrawer is free and MIT licensed. The command copies drawer.tsx into components/ui and installs clsx, tailwind-merge; you can also copy the source from the Code tab by hand.
It pairs well with Morph Dialog, a Pro piece: A card that grows into a dialog: the shell, artwork and title morph between the two, then fold back on close.
Frequently asked questions
- How do I install Drawer?
- Run npx shadcn@latest add https://charcoalui.com/r/drawer.json. The shadcn CLI copies drawer.tsx into components/ui and installs motion, clsx, tailwind-merge. You can also copy the source from this page by hand.
- Is Drawer free for commercial use?
- Yes. Drawer is MIT licensed: use it in any personal or commercial project and change it however you like.
- Does Drawer work with Next.js?
- Yes. It is a client component for React 19 styled with Tailwind CSS 4, so it works in the Next.js App Router and Pages Router, Vite, Remix and Astro.
- Can an AI coding agent install Drawer?
- Yes. Connect the Charcoal UI MCP server (https://charcoalui.com/mcp) to Claude Code, Cursor or any MCP client; get_component returns Drawer's props and source and get_install_command returns the exact command.