Innate UIv0.1.0
Overlays

Sheet

A modal panel that enters from an edge and supports gestures and snap points.

Example

The preview is interactive. The code below it is the docs demo source; demo-only layout classes can be omitted in application code.

tsx
import { Cell } from "retend";

import { Button, Sheet } from "innate-ui";
import classes from "../docs.module.css";

export function SheetDemo() {
  const snapPoint = Cell.source<"12rem" | 0.72 | 1 | null>("12rem");
  return (
    <div class={classes.inlineDemo}>
      <Sheet id="sheet-demo-drawer" side="right">
        <Sheet.Trigger>
          <Button>Open drawer</Button>
        </Sheet.Trigger>
        <Sheet.Content>
          <Sheet.Handle />
          <div class={classes.dialogBody}>
            <Sheet.Title>Project details</Sheet.Title>
            <Sheet.Description>
              Drag the edge handle to dismiss this contextual drawer.
            </Sheet.Description>
            <Sheet.Actions>
              <Sheet.Close>Close</Sheet.Close>
            </Sheet.Actions>
          </div>
        </Sheet.Content>
      </Sheet>

      <Sheet
        id="sheet-demo-bottom"
        side="bottom"
        snapPoints={["12rem", 0.72, 1]}
        snapPoint={snapPoint}
        onSnapPointChange={(value) => snapPoint.set(value)}
        snapToSequentialPoints
      >
        <Sheet.Trigger>
          <Button variant="ghost">Open bottom sheet</Button>
        </Sheet.Trigger>
        <Sheet.Content>
          <Sheet.Handle />
          <div class={classes.dialogBody}>
            <Sheet.Title>Quick actions</Sheet.Title>
            <Sheet.Description>
              Drag the handle to move between snap points or dismiss the sheet.
            </Sheet.Description>
            <Sheet.Actions>
              <Sheet.Close>Done</Sheet.Close>
            </Sheet.Actions>
          </div>
        </Sheet.Content>
      </Sheet>
    </div>
  );
}

API reference

This table is generated from Innate UI's exported TypeScript declarations and JSDoc. Native element attributes inherited by a prop type are not repeated here.

SheetProps

PropTypeDefault
side

Edge of the viewport from which the sheet enters.

JSX.ValueOrCell<SheetSide>"right"
snapPoints

Allowed resting positions for the sheet.

JSX.ValueOrCell<readonly SnapPoint[]>
snapPoint

Current snap point. Defaults to the first configured snap point.

JSX.ValueOrCell<SnapPoint | null>
snapToSequentialPoints

Restricts a gesture to the next adjacent snap point.

JSX.ValueOrCell<boolean>false
swipeToDismiss

Whether dragging past the dismiss threshold closes the sheet.

JSX.ValueOrCell<boolean>true
onSnapPointChange

Called when the active snap point changes.

(snapPoint: SnapPoint | null) => void
idrequired

Stable id used for the dialog content and accessible metadata ids.

string
childrenrequired

Dialog trigger, content, and related compound parts.

JSX.Children
open

Whether the dialog is open.

JSX.ValueOrCell<boolean>false
role

Accessible dialog role.

JSX.ValueOrCell<DialogRole>"dialog"
modal

Whether the dialog is modal.

JSX.ValueOrCell<boolean>true
closeOnInteractOutside

Whether outside interaction dismisses the dialog. Defaults to `false` for alert dialogs and `true` otherwise.

JSX.ValueOrCell<boolean>
closeOnEscape

Whether pressing Escape dismisses the dialog.

JSX.ValueOrCell<boolean>true
onOpenChange

Called when the dialog requests an open-state change.

(open: boolean, reason?: DialogCloseReason) => void

SheetContentProps

PropTypeDefault
childrenrequired

Dialog panel content.

JSX.Children
ref

Receives the native dialog element.

SourceCell<HTMLDialogElement | null>
onCancel

Native `cancel` handler called before Innate dismissal handling.

EventHandlerProp<HTMLDialogElement, Event>
onClose

Native `close` handler.

EventHandlerProp<HTMLDialogElement, Event>
Inspect the typed source →