---
title: "Drawer"
description: "A panel that slides in from an edge of the screen. People drag it with a finger to open or close it, as a bottom sheet or a side panel."
url: https://gelatinui.com/components/drawer
markdown_url: https://gelatinui.com/components/drawer.md
access: free
install: "npx shadcn@latest add @gelatin-ui/drawer"
registry_item: https://gelatinui.com/r/drawer.json
version: "2026-11-08"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Drawer

> A panel that slides in from an edge of the screen. People drag it with a finger to open or close it, as a bottom sheet or a side panel.

Page: https://gelatinui.com/components/drawer

## When to use it

Best for: A panel that slides in from an edge of the screen and follows the finger.

- Use it for a bottom sheet, a side panel, an action sheet, or phone navigation.
- Use `swipeDirection` (`down`, `up`, `left`, `right`) to set the side and the swipe that closes it.
- Use `snapPoints` for a sheet that stops at set heights.
- Use `DrawerSwipeArea` to open it with a swipe from an edge.

## When not to use it

- For a centered task on a desktop page, use a [Dialog](https://gelatinui.com/components/dialog.md).
- For a small panel next to its button, use a [Popover](https://gelatinui.com/components/popover.md).
- For a list of actions from a button, use a Menu.

## Notes for agents

- `swipeDirection` sets the side, and there is no `side` prop. The directions are physical, so a start panel in right to left uses `right`.
- Always render a `DrawerTitle`. It labels the panel.
- Put long content in `DrawerBody`, so the header and the footer stay in view.
- A bottom sheet with fields needs `DrawerVirtualKeyboardProvider` inside `Drawer`, around `DrawerContent`.
- The indent effect needs `DrawerProvider` around the app, with `DrawerIndentBackground` just before `DrawerIndent`.
- `DrawerSwipeArea` is hidden from assistive tools, so keep a real `DrawerTrigger`.
- `DrawerClose` has no look of its own. Render a Button through `render`.
- `DrawerContent` renders the portal and the backdrop. Do not add them again.

## Anatomy

```text
Drawer
├─ DrawerIndentBackground (0..n)
├─ DrawerIndent (0..n)
├─ DrawerTrigger (0..n)
├─ DrawerSwipeArea (0..n)
├─ DrawerSwipeHandle (0..n)
├─ DrawerPortal (0..n)
├─ DrawerOverlay (0..n)
├─ DrawerContent (0..n)
├─ DrawerBody (0..n)
├─ DrawerHeader (0..n)
├─ DrawerTitle (0..n)
├─ DrawerDescription (0..n)
├─ DrawerFooter (0..n)
└─ DrawerClose (0..n)
```

## API reference

### Drawer

Also takes every prop of Base UI `Drawer.Root`: https://base-ui.com/react/components/drawer

### DrawerProvider

Also takes every prop of Base UI `Drawer.Provider`: https://base-ui.com/react/components/drawer

### DrawerVirtualKeyboardProvider

Also takes every prop of Base UI `Drawer.VirtualKeyboardProvider`: https://base-ui.com/react/components/drawer

### DrawerIndentBackground

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

### DrawerIndent

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

### DrawerTrigger

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Drawer.Trigger`: https://base-ui.com/react/components/drawer

### DrawerSwipeArea

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Drawer.SwipeArea`: https://base-ui.com/react/components/drawer

### DrawerSwipeHandle

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### DrawerPortal

Also takes every prop of Base UI `Drawer.Portal`: https://base-ui.com/react/components/drawer

### DrawerOverlay

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Drawer.Backdrop`: https://base-ui.com/react/components/drawer

### DrawerContent

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `backdrop` | `boolean` | true | Dim the page under the drawer (Base UI `Drawer.Backdrop`). Default `true`. |
| `showSwipeHandle` | `boolean` | true | Show the grab bar on bottom and top sheets. Default `true`. |
| `showCloseButton` | `boolean` | false | Show the close button (a 24px ghost icon button) in the top end corner. Default `false`. |
| `closeLabel` | `string` | "Close" | The accessible name of the close button. Translate it with the page. |
| `portalProps` | `Omit` |  | Other Base UI props of the inner parts. A `className` here adds to the component classes. |
| `backdropProps` | `DrawerOverlayProps` |  |  |
| `viewportProps` | `PopupPartProps` |  |  |
| `closeButtonProps` | `PopupPartProps` |  |  |

Also takes every prop of Base UI `Drawer.Popup`: https://base-ui.com/react/components/drawer

### DrawerBody

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

### DrawerHeader

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### DrawerTitle

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

### DrawerDescription

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

### DrawerFooter

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### DrawerClose

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| DrawerIndentBackground | `drawer-indent-background` |  |  |  |
| DrawerIndent | `drawer-indent` | `data-active` | `--drawer-swipe-progress`, `--drawer-swiping`, `--motion-ease-panel`, `--motion-sheet` | `motion-timing` |
| DrawerTrigger | `drawer-trigger` | `data-disabled` |  |  |
| DrawerSwipeArea | `drawer-swipe-area` | `data-disabled`, `data-swipe-direction` |  |  |
| DrawerSwipeHandle | `drawer-swipe-handle` | `data-swipe-direction` |  |  |
| DrawerPortal | `drawer-portal` |  |  |  |
| DrawerOverlay | `drawer-overlay` | `data-ending-style`, `data-starting-style`, `data-swipe-dismiss` | `--drawer-swipe-progress`, `--drawer-swiping`, `--motion-ease-panel`, `--motion-sheet` | `motion-timing` |
| DrawerContent | `drawer-content` | `data-ending-style`, `data-nested-drawer-swiping`, `data-starting-style`, `data-swipe-direction`, `data-swiping` | `--drawer-frontmost-height`, `--drawer-height`, `--drawer-keyboard-inset`, `--drawer-scale`, `--drawer-snap-point-offset`, `--drawer-stack`, `--drawer-swipe-movement-x`, `--drawer-swipe-movement-y`, `--drawer-swipe-progress`, `--drawer-swipe-strength`, `--drawer-x`, `--drawer-y`, `--motion-ease-panel`, `--motion-sheet`, `--nested-drawers`, `--radius-xl` | `motion-timing` |
| DrawerBody | `drawer-body` |  |  |  |
| DrawerHeader | `drawer-header` | `data-swipe-direction` |  |  |
| DrawerTitle | `drawer-title` |  |  |  |
| DrawerDescription | `drawer-description` |  |  |  |
| DrawerFooter | `drawer-footer` |  |  |  |
| DrawerClose | `drawer-close` | `data-disabled` |  |  |

## Usage

`swipeDirection` sets the side. Always render a `DrawerTitle`, and put long content in `DrawerBody`.

The sample also uses `button`, which this add does not write. One command adds them with this item:

```bash
npx shadcn@latest add @gelatin-ui/drawer @gelatin-ui/button
```

```tsx title="filters-drawer.tsx"
import { Button } from "@/components/ui/button";
import {
  Drawer,
  DrawerClose,
  DrawerContent,
  DrawerDescription,
  DrawerFooter,
  DrawerHeader,
  DrawerTitle,
  DrawerTrigger,
} from "@/components/ui/drawer";

export function FiltersDrawer() {
  return (
    <Drawer>
      <DrawerTrigger render={<Button variant="outline" />}>Filters</DrawerTrigger>
      <DrawerContent>
        <DrawerHeader>
          <DrawerTitle>Filters</DrawerTitle>
          <DrawerDescription>Show tasks that match all of these.</DrawerDescription>
        </DrawerHeader>
        <DrawerFooter>
          <DrawerClose render={<Button />}>Show 12 tasks</DrawerClose>
        </DrawerFooter>
      </DrawerContent>
    </Drawer>
  );
}
```

## Compose

Rules:

- Sheets on phones (`phone-sheets`): Show a dialog or a large popover as a bottom sheet on a small screen.
- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/drawer
```

It adds 17 registry items: 14 files, 2715 lines, and the npm packages `@base-ui/react`, `@phosphor-icons/react`, `clsx`, `tailwind-merge`, `tailwind-variants`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Dialog](https://gelatinui.com/components/dialog.md): Pick Dialog for a centered task on a desktop page, with no drag and no edge.
- [Popover](https://gelatinui.com/components/popover.md): Pick Popover for a small panel next to its button, not a panel from an edge of the screen.
- [Alert Dialog](https://gelatinui.com/components/alert-dialog.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Enter, Space | On the trigger, opens the drawer. |
| Tab | Moves focus between the elements in the drawer. With the default `modal`, focus stays inside. |
| Escape | Closes the drawer. |

## Accessibility

It is a Base UI Drawer, a dialog with gestures. `DrawerTitle` names it, and focus stays inside while it is modal.

Escape closes it, and focus goes back to the trigger.

`DrawerSwipeArea` is hidden from assistive tools, so keep a real `DrawerTrigger`.

## Motion

| Part | Motion |
| --- | --- |
| Open and close | sheet · 300ms · ease-panel (0.2, 0.4, 0.2, 1) · slides from the edge; no transition while the finger drags |
