Sheet
A modal panel that enters from an edge and supports gestures and snap points.
SheetView sourceExample
The preview is interactive. The code below it is the docs demo source; demo-only layout classes can be omitted in application code.
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
| Prop | Type | Default |
|---|---|---|
sideEdge of the viewport from which the sheet enters. | JSX.ValueOrCell<SheetSide> | "right" |
snapPointsAllowed resting positions for the sheet. | JSX.ValueOrCell<readonly SnapPoint[]> | — |
snapPointCurrent snap point. Defaults to the first configured snap point. | JSX.ValueOrCell<SnapPoint | null> | — |
snapToSequentialPointsRestricts a gesture to the next adjacent snap point. | JSX.ValueOrCell<boolean> | false |
swipeToDismissWhether dragging past the dismiss threshold closes the sheet. | JSX.ValueOrCell<boolean> | true |
onSnapPointChangeCalled when the active snap point changes. | (snapPoint: SnapPoint | null) => void | — |
idrequiredStable id used for the dialog content and accessible metadata ids. | string | — |
childrenrequiredDialog trigger, content, and related compound parts. | JSX.Children | — |
openWhether the dialog is open. | JSX.ValueOrCell<boolean> | false |
roleAccessible dialog role. | JSX.ValueOrCell<DialogRole> | "dialog" |
modalWhether the dialog is modal. | JSX.ValueOrCell<boolean> | true |
closeOnInteractOutsideWhether outside interaction dismisses the dialog. Defaults to `false` for alert dialogs and `true` otherwise. | JSX.ValueOrCell<boolean> | — |
closeOnEscapeWhether pressing Escape dismisses the dialog. | JSX.ValueOrCell<boolean> | true |
onOpenChangeCalled when the dialog requests an open-state change. | (open: boolean, reason?: DialogCloseReason) => void | — |
SheetContentProps
| Prop | Type | Default |
|---|---|---|
childrenrequiredDialog panel content. | JSX.Children | — |
refReceives the native dialog element. | SourceCell<HTMLDialogElement | null> | — |
onCancelNative `cancel` handler called before Innate dismissal handling. | EventHandlerProp<HTMLDialogElement, Event> | — |
onCloseNative `close` handler. | EventHandlerProp<HTMLDialogElement, Event> | — |