Sheet
npx shadcn add @klarhimmel/sheet @klarhimmel/buttonCopy for AIExamples
Filters
Bottom
Left
DetailsAbout, usage, props and more
A modal side panel for a task that keeps the page in view. Built like Dialog.
When to use
Use for
Filters, a cart or record details: a side task next to the page.
Not for
Navigation menus. Short decisions. Use Dialog or AlertDialog.
Pairs with
Button, Field, Checkbox.
Preview
No filters applied.
Import
Import
- Files
- sheet.tsx, button.tsx, in components/klarhimmel/ui/. With it: editing, icon-button, theme, utils. npm: lucide-react, radix-ui.
- Render in
- Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.
- Limit
- Overlays render into the Theme root with position: fixed. A transform on an ancestor re-parents fixed (a dialog centres in the wrapper) and overflow: hidden clips menus. Render <Theme> at the app root, outside any transformed wrapper.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
Sheet.open | boolean | - | The element that opens it; or control it. |
Sheet.defaultOpen | boolean | - | |
Sheet.onOpenChange | (open: boolean) => void | - | The element that opens it; or control it. |
Sheet.trigger | ReactNode | - | The element that opens it (a Button). Focus returns to it on close. |
Sheet.title | string | required | Required: names the panel. |
Sheet.description | string | - | One sentence under the title, read out with it. |
Sheet.side | 'right' | 'left' | 'bottom' | - | Which edge it slides from. On a narrow screen a left or right sheet takes the full width. |
Sheet.children | ReactNode | - | |
Sheet.footer | ReactNode | - | Buttons, pinned under the body. |
Sheet.header | ReactNode | - | Replaces the title row (the title still names the panel for screen readers); it draws its own close (SheetClose). |
Sheet.flush | boolean | - | The body has no padding or gap: its content sets its own (a document page). |
Sheet.closeLabel | string | - | The close button's name for screen readers, in the page's language ('Stäng'). Default 'Close'. |
Sheet.className | string | - | Extra classes, merged after the component's own. |
SheetClose.children | ReactNode | required |
Accessibility
| Key | Does |
|---|---|
Tab / Shift+Tab | Cycles inside the sheet; the page behind is unreachable |
Escape | Closes and returns focus to the trigger |
Enter / Space | Activates the focused button |
Same behaviour as Dialog: modal, labelled, focus returns. Left and right sheets take the full width on a narrow screen.
Accessibility