---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Sheet

A panel that slides in from an edge of the window over the page, for filters, a form or a record's details, for React and Tailwind CSS. Free, MIT.

Free. Its export: `Sheet`.

## Try it

Pick the edge, then open Filters: the sheet slides in from it, the focus stays inside it. Tick filters and Apply: the task list under the button follows and the button counts them. Cancel, Escape or the cross keep the list as it was. Turn on Long for a body that scrolls.

The tasks live in the page only.

## When to use

- A panel that slides in from an edge of the window over the page, for filters, a form or a record's details.
- Also called: drawer, side panel or slide-over.

## When not to use

- For a centred task use Dialog.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Sheet on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing.

```sh
npx shadcn@4.23.1 add @goop/trail-sheet
```

```text
Add the Goop Sheet to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, useSheetDragArea, SheetTitle, SheetDescription, SheetBody, SheetFooter } from '@/components/ui/goop/sheet';
import { Button } from '@/components/ui/goop/button';
import { Checkbox } from '@/components/ui/goop/checkbox';
import { DestructiveButton } from '@/components/ui/goop/destructive-button';

<Sheet>
  <SheetTrigger asChild>
    <Button variant="outline">Filters</Button>
  </SheetTrigger>
  <SheetContent closeLabel="Close filters">
    <SheetHeader>
      <SheetTitle>Filters</SheetTitle>
      <SheetDescription>Narrow the list to the notes you need.</SheetDescription>
    </SheetHeader>
    <SheetBody>
      <label className="flex items-center gap-2">
        <Checkbox defaultChecked /> Only my notes
      </label>
    </SheetBody>
    <SheetFooter
      start={
        <SheetClose asChild>
          <DestructiveButton icon="trash">Delete view</DestructiveButton>
        </SheetClose>
      }
    >
      <SheetClose asChild>
        <Button>Done</Button>
      </SheetClose>
    </SheetFooter>
  </SheetContent>
</Sheet>
```

- Fits: schedule (its recipe).
- Also known as: Drawer.
- height, width, padding, gap, corner, border, background, shadow, text, motion: add no class for these.

## API reference

### Options

- `open?: boolean`
- `defaultOpen?: boolean = false`
- `onOpenChange?: (open: boolean) => void`

- Takes every prop of Dialog but modal (its page: dialog.md)
- State: open (open / defaultOpen / onOpenChange); drawn by data-state=closed

### Parts

- `SheetTrigger` — Wraps the control that opens the sheet; put the theme's Button inside with asChild; also takes asChild?: boolean
- `SheetClose` — Wraps a control that closes the sheet, such as a Cancel button in the footer; also takes asChild?: boolean
- `SheetContent` — The scrim and the edge panel, in a portal — the end of `<body>`, or `container`; side: end (default), start, left, right, top, bottom; container?: HTMLElement | null — Where the layer is portalled; the end of `<body>` when left out; closeLabel?: string = 'Close' — The spoken name of the header's close button; swipeable?: boolean = true — On a touch screen, dragging the header (or a row `useSheetDragArea` marks) toward the sheet's edge, or flicking it, closes the sheet (true, the default)
- `SheetHeader` — The sheet's top row; put the SheetTitle and SheetDescription in it; actions?: ReactNode — Round buttons before the close button (the theme's `IconButton`, or a `TopBarAction`), on the title's top line
- `SheetTitle` — The words that name the sheet, in its header beside the close button; every sheet has one
- `SheetDescription` — Words that describe the panel
- `SheetBody` — The sheet's scrolling content (fields, lists, text), between its header and footer
- `SheetFooter` — The sheet's bottom row; put its buttons in it, drawn at its end, and an action apart from them in `start`; start?: ReactNode — An action at the footer's start edge, apart from the buttons at its end (the theme's `DestructiveButton`)
- `useSheetDragArea` — For a top row of your own drawn in place of a `SheetHeader` (a record's title row with its own buttons)

- Required: SheetTitle, inside SheetContent
- Class recipes (cva): sheetVariants (SheetContent)
- data-slot values (to select a part by): sheet-body, sheet-content, sheet-description, sheet-footer, sheet-footer-start, sheet-header, sheet-header-content, sheet-title

## Keyboard

- Escape: close
- Tab: move to the next control

## Accessibility

- The behaviour layer under the part answers keys, focus and dismissal: never write your own.
- expanded: the attribute data-state=closed
- open: the attribute data-state=closed

## Motion

- The part sets its own motion: add no transition or animation of your own.

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

## Related

- [Dialog](/themes/trail/components/dialog): A window over the page for one focused task, such as a short form.
- [Button](/themes/trail/components/button): A button with words that runs an action, in several looks and sizes.
- [Checkbox](/themes/trail/components/checkbox): A box a person ticks to turn one option on or off.
- [Destructive button](/themes/trail/components/destructive-button): The button for an action that deletes or cannot be undone, marked in the danger colour.
