Sheet

Overlays

A panel that slides in from an edge of the screen, as a modal dialog: <Sheet.Root> (bind:open) holds a Sheet.Trigger (a Button: variant, size) and a Sheet.Content (side: right by default, left, top, bottom) with a Sheet.Header (Sheet.Title, Sheet.Description), the body and a Sheet.Footer of actions, often a Sheet.Close. It is Bits UI's Dialog with Zest's own look: focus moves in and is trapped, Escape and the overlay close it, and focus returns to the trigger.

import { Sheet } from '@limerdev/zest';
Sheet for AI tools (llms.txt)
Use for
Editing or viewing a record beside the list it came from; filters; navigation on a small screen.
Don't
A short question or confirmation: use Dialog or AlertDialog. Content people keep open while they work in the page: put it in the page.

Examples

Edit form

A form beside the page: a header, the fields, and a footer of actions.

Sides

side: the edge it slides in from.

Props

Every part also takes class (merged over its defaults), ref (bindable: the element), children, and child (a snippet that renders your own element, with props to spread on it).

Sheet.Root

Prop Type Default Description
onOpenChange OnChangeFn<boolean> – A callback that is called when the popover's open state changes.
onOpenChangeComplete OnChangeFn<boolean> – A callback called when the dialog finishes opening/closing animations.
open bindable boolean false The open state of the dialog.

Sheet.Trigger

Prop Type Default Description
size "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg" 'default' The height and padding, from the theme's field size; the icon sizes are square.
variant "link" | "primary" | "secondary" | "neutral" | "error" | "outline" | "ghost" 'primary' The look, by the theme's colour roles: primary for the main action, error for deleting, secondary, neutral and outline for the rest, ghost in toolbars, link for a navigation that looks like text.

Sheet.Close

Prop Type Default Description
size "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg" 'default' The height and padding, from the theme's field size; the icon sizes are square.
variant "link" | "primary" | "secondary" | "neutral" | "error" | "outline" | "ghost" 'primary' The look, by the theme's colour roles: primary for the main action, error for deleting, secondary, neutral and outline for the rest, ghost in toolbars, link for a navigation that looks like text.

Sheet.Portal

Prop Type Default Description
disabled boolean false Disable portalling and render the component inline
to PortalTarget document.body Where to portal the content to.

Sheet.Overlay

Prop Type Default Description
forceMount boolean – Whether to force mount the component.

Sheet.Content

Prop Type Default Description
closeLabel string the Config's `strings.close`, else 'Close' The close button's name for screen readers.
escapeKeydownBehavior "close" | "defer-otherwise-close" | "defer-otherwise-ignore" | "ignore" close Escape behavior type. close: Closes the element immediately. defer-otherwise-close: Delegates the action to its parent component that has an escape keydown handler. If no parent is found, it closes the element. defer-otherwise-ignore: Delegates the action to the parent element. If no parent is found, nothing is done. ignore: Prevents the element from closing and also blocks the parent element from closing in response to an escape key press.
forceMount boolean – Whether to force mount the component.
interactOutsideBehavior "close" | "defer-otherwise-close" | "defer-otherwise-ignore" | "ignore" close Interact outside behavior type. close: Closes the element immediately. defer-otherwise-close: Delegates the action to the parent element. If no parent is found, it closes the element. defer-otherwise-ignore: Delegates the action to the parent element. If no parent is found, nothing is done. ignore: Prevents the element from closing and also blocks the parent element from closing in response to an outside interaction.
onCloseAutoFocus EventCallback – Event handler called when auto-focusing on close. Can be prevented.
onEscapeKeydown ((e: KeyboardEvent) => void) – Callback fired when escape is pressed.
onFocusOutside ((event: FocusEvent) => void) – Callback fired when focus leaves the dismissible layer.
onInteractOutside InteractOutsideEventHandler – Callback fired when an outside interaction event completes, which is either a pointerup, mouseup, or touchend event, depending on the user's input device.
onOpenAutoFocus EventCallback – Event handler called when auto-focusing on open. Can be prevented.
portalProps PortalProps – Props for the portal the content renders in: to (the element to render in, the body by default) and disabled (render in place).
preventBodyPointerEvents boolean true Whether to set pointer-events: none on the <body> while the dialog is open. When false and a Dialog.Overlay is rendered, the overlay blocks pointer interaction with the page instead, which avoids restyling every element on the page when the dialog opens and closes. Without an overlay, the body is still blocked. Elements stacked above the overlay that aren't part of the dialog (toasts, a header with a higher z-index) receive pointer events when this is false.
preventOverflowTextSelection boolean true Passing true will prevent the overflow of text selection outside the element, provided the element is the top layer.
preventScroll boolean true Whether to prevent body scrolling when the content is open.
restoreScrollDelay number | null null The delay in milliseconds before the scrollbar is restored after closing the dialog. This is only applicable when using the child snippet for custom transitions and preventScroll is true. You should set this to a value greater than the transition duration to prevent content from shifting during the transition.
showCloseButton boolean true Show a close button in the corner.
side "top" | "right" | "bottom" | "left" 'right' The edge of the screen the sheet slides in from.
trapFocus boolean false Whether focus is trapped within the focus scope.

Sheet.Header

No props of its own beyond the common ones.

Sheet.Footer

No props of its own beyond the common ones.

Sheet.Title

Prop Type Default Description
level 1 | 2 | 3 | 4 | 5 | 6 – The heading level of the dialog title.

Sheet.Description

No props of its own beyond the common ones.