Your next page is taking shape...

Opening Your Next Page…

Loading the guide and preparing its examples for you to explore. The page will appear here automatically when it’s ready, so you can keep this view open without refreshing.

Made for Preact. Built to be yours.

Overlays & Actions

Sheet

Sheet extends Dialog to render content from a viewport edge. Reveal the right amount of context without losing the user's place in the interface. Keep the trigger, content and dismissal behavior working as one interaction. Import it from @/components/kamod-ui/sheet.

Source · Design reference · API reference · Theming · Styles


Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Installation

Import Sheet primitives from @/components/kamod-ui/sheet. Motion is optional — core SheetContent includes CSS slide animations.

Install PackagesTerminal
pnpm add @kamod-ch/ui

Copy an example with @kamod-ch/ui or the matching @kamod-ch/ui/… subpath. The code block switches between those two installs. Connect The Global Theme CSS and Tailwind Source Detection before your first render.

Usage

Use SheetTrigger to open and SheetContent with side="top" | "right" | "bottom" | "left". Left and right panels accept max-width utilities; top and bottom span the viewport width. Bottom/top padding includes safe-area insets for notched devices.

Import SetupTypeScript
import { Sheet } from "@kamod-ch/ui";

Choose a complete composition from the examples below; required child components and props vary by pattern.

Component Examples & Variants

Explore Sheet in Different Contexts, from the starting pattern to the compositions below. Begin with Basic, then compare the examples that match your content, state and layout. These are working patterns to adapt, not a list of interchangeable variant values: check the API Reference before using a prop or combining behaviors. Look at the surrounding labels, supporting text and spacing as well as the component itself.

Read the Result and Its Implementation Together. Use each showcase’s Code view to inspect imports and composition, or its Prompt view to prepare a setup or adaptation brief. Try the narrow preview and local theme controls before connecting real data, and use Reset to return an example to its initial state. Keep layout changes in class utilities where appropriate; follow the Component Styles Guide for hierarchy and the Theming Guide for shared surfaces and colors. The Accessibility Notes explain what to preserve when making those changes.

Basic

Keep a Focused Task Beside the Page. Open Sheet with a clear title and description to provide temporary context beside the main page. The edge panel can support a focused task while preserving the reader's sense of the screen behind it.

Open and dismiss the preview with the keyboard, checking that focus returns to a sensible trigger. If the task grows into a long, multi-step workflow, consider a dedicated page instead of making the temporary panel increasingly dense.

src/components/SheetExample.tsx22 lines
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, SheetTrigger } from "@kamod-ch/ui";

export const Example = () => (
  <Sheet>
    <SheetTrigger>Open</SheetTrigger>
    <SheetContent side="right" class="max-w-md">
      <SheetHeader>
        <SheetTitle>Edit profile</SheetTitle>
        <SheetDescription>
          Make changes to your profile here. Click save when you're done.
        </SheetDescription>
      </SheetHeader>
      <div class="stack">
        <Label for="sheet-name">Name</Label>
        <Input id="sheet-name" value="@peduarte" />
      </div>
      <SheetFooter>
        <Button>Save changes</Button>
      </SheetFooter>
    </SheetContent>
  </Sheet>
);

Side

Match the Edge to the Available Reading Space. Set side on SheetContent to choose the panel's edge. Top and bottom sheets span the viewport width, while left and right sheets can use maximum-width utilities appropriate to their content.

Test long content and short viewports for every supported direction; width utilities suitable for a right sheet may make a bottom sheet feel unexpectedly narrow.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

No Close Button

Provide Another Visible Way to Leave. Set showCloseButton={false} when your sheet supplies another visible dismissal control. Removing the built-in corner action should be a deliberate composition choice, with an understandable way to leave the panel still available.

Keep a named close or cancel action in the content, preserve keyboard behavior and define what happens to unsaved input when the panel closes.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width
API reference

Props and Data

Configure Sheet using the contracts below. Read the documented options alongside the Source Definitions to understand which values your application supplies and which details the component owns. Start with a prop or helper, then follow its type link to inspect the declaration without leaving the page.

Props, slots and variants for this component.

API reference
Your API, from source

Type cards are extracted from this checkout’s TypeScript source at build time. Props inherited through HTMLAttributes, Omit or variant helpers remain references in those declarations; their fields are not flattened here. Match the reference to your installed version, and check a package’s exports before writing an import type. A type exported by a source file is not necessarily re-exported by @kamod-ch/ui.

Component Props

Read each option with its owning component. The
marker identifies required fields verified in that declaration. A ? means a field can be omitted; it does not promise a fallback value. Existing documented defaults remain alongside the descriptions. For callbacks, check the argument and return types before connecting your own state or services.
@kamod-ch/ui/sheet39.2 KB min · 9.3 KB gzipSignals: via dialog@preact/signals

Sheet

SheetProps

Sheet documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildSheetProps

Configure children for Sheet. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
defaultOpen
booleanSheetProps

Configure defaultOpen for Sheet. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
dismissible
booleanSheetProps

When false, Escape and an overlay click leave the dialog open. An explicit close control still closes it. Default true.

Default
—
lockBodyScroll
booleanSheetProps

When true, locks document scroll while open (shadcn default).

Default
true
onOpenChange
((open: boolean) => void)SheetProps

Configure onOpenChange for Sheet. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
open
booleanSheetProps

Configure open for Sheet. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

SheetClose

DialogCloseProps

SheetClose documented props
Prop / typeDescription
asChild
boolean

Configure asChild for SheetClose. Compare its accepted type with the Usage Guidance before supplying a value.

Default
false
children
ComponentChild[] | ComponentChild

Configure children for SheetClose. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
data-slot
string

Configure data-slot for SheetClose. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onClick
MouseEventHandler<HTMLButtonElement>

Configure onClick for SheetClose. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
ref
Ref<HTMLButtonElement>

Configure ref for SheetClose. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

SheetContent

SheetContentProps

SheetContent documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildSheetContentProps

Configure children for SheetContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>SheetContentProps

Configure class for SheetContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
data-slot
stringSheetContentProps

Configure data-slot for SheetContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
forceMount
booleanSheetContentProps

Configure forceMount for SheetContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
false
showCloseButton
booleanSheetContentProps

Configure showCloseButton for SheetContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
true
side
"bottom" | "top" | "right" | "left"SheetContentProps

Configure side for SheetContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
"right"

SheetDescription

DialogDescriptionProps

SheetDescription documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChild

Configure children for SheetDescription. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>

Configure class for SheetDescription. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
id
string | SignalLike<string | undefined>

Configure id for SheetDescription. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

SheetFooter

SheetFooterProps

SheetFooter documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildSheetFooterProps

Configure children for SheetFooter. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

SheetHeader

SheetHeaderProps

SheetHeader documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildSheetHeaderProps

Configure children for SheetHeader. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

SheetTitle

DialogTitleProps

SheetTitle documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChild

Configure children for SheetTitle. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>

Configure class for SheetTitle. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
id
string | SignalLike<string | undefined>

Configure id for SheetTitle. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

SheetTrigger

DialogTriggerProps

SheetTrigger documented props
Prop / typeDescription
asChild
boolean

Configure asChild for SheetTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
false
children
ComponentChild[] | ComponentChild

Configure children for SheetTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
data-slot
string

Configure data-slot for SheetTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onClick
MouseEventHandler<HTMLButtonElement>

Configure onClick for SheetTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onPointerDown
PointerEventHandler<HTMLButtonElement>

Configure onPointerDown for SheetTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
ref
Ref<HTMLButtonElement>

Configure ref for SheetTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

Data Type Reference

Expand a card to inspect and copy the exact declaration. The code header identifies its repository file; follow imported or inherited types in the Implementation Source when you need the complete dependency chain. Required-field summaries cover fields declared directly in that type. Source-only helpers and inferred schema outputs describe the local implementation, not additional props you can pass to every component.

Sheet Props

1 declared field
SheetProps
Exported Source Declaration from Sheet.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of SheetProps before adapting it.

SheetContent Props

5 declared fields
SheetContentProps
Exported Source Declaration from SheetContent.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of SheetContentProps before adapting it.

SheetFooter Props

1 declared field
SheetFooterProps
Exported Source Declaration from SheetFooter.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of SheetFooterProps before adapting it.

SheetHeader Props

1 declared field
SheetHeaderProps
Exported Source Declaration from SheetHeader.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of SheetHeaderProps before adapting it.

Accessibility

Build the Complete Interaction, Including the Parts Outside Sheet. The notes below distinguish the current implementation from the labels, content and behavior your application supplies. Start with the Live Preview, check the Props and Data Reference, and test the finished composition with real content rather than assuming that an unchanged visual example covers every use case.

Built-in Behavior and Defaults

SheetContent renders a modal dialog surface with title/description relationships and a named Close sheet control. Its side placement changes presentation, not the need for a meaningful dialog name and a complete keyboard flow.

Labels and Relationships

Use SheetTitle to identify the panel, such as Account settings, and a description when the task needs context. Name close and secondary actions clearly. A mobile navigation sheet still needs its own title even when the links inside are familiar.

Keyboard and Focus

Check opening, initial focus, contained Tab order and dismissal in the actual layout. Keep the final action reachable when content is taller than the viewport. After closing, focus should return to a visible trigger or another intentional destination.

States and Integration Details

Avoid rendering a desktop panel and a mobile sheet as two simultaneously focusable copies. Do not cover the close action with a fixed header or footer, and preserve label IDs when responsive composition changes.

Verify the Complete Interaction

Check Behavior as Well as Markup. Work through these scenarios in the application where the component will be used. Automated checks can help find structural problems; also review the reading experience with a screen reader, keyboard focus and the actual feedback from your application.

  1. Open and dismiss on both wide and narrow screens with focus clearly visible.
  2. Traverse a long sheet at enlarged text size and reach every action without escaping behind it.
  3. Resize while open and check that no duplicate dialog, stale body lock or lost focus remains.

Recheck the result after changing Theme Tokens, translations or class overrides. Include text enlargement, narrow layouts and reduced-motion settings where animation is present. Inspect the Component Source when a behavior differs from your expectation; a role or state attribute does not implement keyboard interaction by itself.

For background, read the WAI-ARIA Authoring Guidance and Keyboard Interface Guidance. These explain the patterns; verify browser and assistive-technology behavior for the implementation and audience you actually support.

Take the Next Useful Step

You have the pieces. Put them into one real interaction, keep its state in one place, and check the result with the content your application will actually show.

Connect the Foundation

Return to Choose and Compose Components to connect this reference to a working screen. Keep global CSS in one entrypoint and import only the components that screen needs.

Build the Surrounding Screen

Find a neighboring interaction in the Component Library, or start with a complete Block. Replace sample content and destinations before refining the layout; a local class change can stay with the composition.

Make the Result Hold Up

Use shared theme roles for changes that belong everywhere. Then review the whole journey: keyboard focus, long labels, narrow screens and a clear way to recover when something fails.

Keep a link to the source and note your intentional changes. Your next edit should begin with a clear decision, not another search.