npx shadcn@4.23.1 add @goop/meadow-sheetSheet
FreeA panel that comes in along an edge of the window over the page, for a record's details, a form or filters, for React and Tailwind CSS. Free, MIT.
What an agent sees
- SheetTriggerWraps the control that opens the sheet
- SheetCloseWraps a control that closes the sheet, such as a Cancel button in the footer
- SheetContentThe scrim and the edge panel, in a portal — the end of
<body>, orcontainer - SheetHeaderThe sheet's top row
- SheetTitleThe words that name the sheet, in its header beside the close button
- SheetDescriptionWords that say what the sheet is for, read out with its title
- SheetBodyThe sheet's scrolling content (fields, rows, words), between its header and footer
- SheetFooterThe sheet's bottom row
- useSheetDragAreaFor a top row of your own drawn in place of a
SheetHeader(a record's title row with its own buttons)
import { useSheetDragArea } from '@/components/ui/goop/sheet';
import { Button } from '@/components/ui/goop/button';
import {
Sheet,
SheetBody,
SheetClose,
SheetContent,
SheetDescription,
SheetFooter,
SheetHeader,
SheetTitle,
SheetTrigger,
} from '@/components/ui/goop/sheet';
import { TextInput } from '@/components/ui/goop/text-input';
function VisitDetails({ onSave }: { onSave: () => void }) {
return (
<Sheet>
<SheetTrigger asChild>
<Button variant="outline">Visit details</Button>
</SheetTrigger>
<SheetContent>
<SheetHeader>
<SheetTitle>Visit details</SheetTitle>
<SheetDescription>Thursday, 9:00 AM at the north field</SheetDescription>
</SheetHeader>
<SheetBody>
<TextInput aria-label="Visit name" defaultValue="Site survey day" />
<TextInput aria-label="Crew" defaultValue="Field team B" />
</SheetBody>
<SheetFooter>
<SheetClose asChild>
<Button variant="outline">Cancel</Button>
</SheetClose>
<SheetClose asChild>
<Button onClick={onSave}>Save</Button>
</SheetClose>
</SheetFooter>
</SheetContent>
</Sheet>
);
}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 comes in along an edge of the window over the page, for a record's details, a form or filters.
- 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.
npx shadcn@4.23.1 add @goop/meadow-sheetAdd the Goop Sheet to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { useSheetDragArea } from '@/components/ui/goop/sheet';
import { Button } from '@/components/ui/goop/button';
import {
Sheet,
SheetBody,
SheetClose,
SheetContent,
SheetDescription,
SheetFooter,
SheetHeader,
SheetTitle,
SheetTrigger,
} from '@/components/ui/goop/sheet';
import { TextInput } from '@/components/ui/goop/text-input';
function VisitDetails({ onSave }: { onSave: () => void }) {
return (
<Sheet>
<SheetTrigger asChild>
<Button variant="outline">Visit details</Button>
</SheetTrigger>
<SheetContent>
<SheetHeader>
<SheetTitle>Visit details</SheetTitle>
<SheetDescription>Thursday, 9:00 AM at the north field</SheetDescription>
</SheetHeader>
<SheetBody>
<TextInput aria-label="Visit name" defaultValue="Site survey day" />
<TextInput aria-label="Crew" defaultValue="Field team B" />
</SheetBody>
<SheetFooter>
<SheetClose asChild>
<Button variant="outline">Cancel</Button>
</SheetClose>
<SheetClose asChild>
<Button onClick={onSave}>Save</Button>
</SheetClose>
</SheetFooter>
</SheetContent>
</Sheet>
);
}- Fits: board (its recipe).
- Also known as: Drawer.
- height, width, padding, gap, corner, border, background, text, motion: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| 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)
| Part | What it is |
|---|---|
| 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, swiping the header (or a row useSheetDragArea marks) toward the sheet's edge past a third of the panel, or flicking it, closes the sheet (true, the default); the panel does not follow the finger |
| SheetHeader | The sheet's top row; put the SheetTitle and SheetDescription in it; actions?: ReactNode — Round quiet buttons before the close button (the theme's IconButton ghost), on the title's row |
| SheetTitle | The words that name the sheet, in its header beside the close button; every sheet has one |
| SheetDescription | Words that say what the sheet is for, read out with its title; put them under the SheetTitle |
| SheetBody | The sheet's scrolling content (fields, rows, words), between its header and footer |
| SheetFooter | The sheet's bottom row; put its buttons in it, the main action last, 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)
Keyboard
| Key | What it does |
|---|---|
| Enter | On the trigger: open, the focus on the panel's first control |
| Space | On the trigger: open, the focus on the panel's first control |
| Tab Shift+Tab | Cycle the focus through the panel's controls, never out of it |
| Escape | Close, the focus back on the trigger |
Accessibility
- The behaviour layer under the part answers keys, focus and dismissal: never write your own.
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.