Skip to content
Klarhimmel UI

Sheet

npx shadcn add @klarhimmel/sheet @klarhimmel/button

Examples

  • 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.

sheet.tsx
import { Theme } from '@/components/klarhimmel/theme/style';
import { Button } from '@/components/klarhimmel/ui/button';
import { Sheet, SheetClose } from '@/components/klarhimmel/ui/sheet';

export default function Example() {
  return (
    <Theme theme="brand">
      <Sheet
        title="Filter rooms"
        trigger={<Button variant="secondary">Filters</Button>}
        footer={<SheetClose><Button>Show rooms</Button></SheetClose>}
      >
        …
      </Sheet>
    </Theme>
  );
}

Import

Import

import { Sheet, SheetClose } from '@/components/klarhimmel/ui/sheet';
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

PropTypeDefaultDescription
Sheet.openboolean-The element that opens it; or control it.
Sheet.defaultOpenboolean-
Sheet.onOpenChange(open: boolean) => void-The element that opens it; or control it.
Sheet.triggerReactNode-The element that opens it (a Button). Focus returns to it on close.
Sheet.titlestringrequiredRequired: names the panel.
Sheet.descriptionstring-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.childrenReactNode-
Sheet.footerReactNode-Buttons, pinned under the body.
Sheet.headerReactNode-Replaces the title row (the title still names the panel for screen readers); it draws its own close (SheetClose).
Sheet.flushboolean-The body has no padding or gap: its content sets its own (a document page).
Sheet.closeLabelstring-The close button's name for screen readers, in the page's language ('Stäng'). Default 'Close'.
Sheet.classNamestring-Extra classes, merged after the component's own.
SheetClose.childrenReactNoderequired

Accessibility

KeyDoes
Tab / Shift+TabCycles inside the sheet; the page behind is unreachable
EscapeCloses and returns focus to the trigger
Enter / SpaceActivates the focused button

Same behaviour as Dialog: modal, labelled, focus returns. Left and right sheets take the full width on a narrow screen.

Accessibility