Extends the Dialog component to display content that complements the main content of the screen.
Loading...
Installation
Install the following dependencies:
Copy and paste the following code into your project.
Loading...
Update the import paths to match your project setup.
Composition
Sheet ├── SheetTrigger └── SheetContent ├── SheetHeader │ ├── SheetTitle │ └── SheetDescription ├── content ├── SheetFooter (optional) └── SheetClose
Examples
Bottom
Loading...
Comments
Loading...
Default
Loading...
Event
Loading...
Order
Loading...
Payment
Loading...
Shortcuts
Loading...
API Reference
Sheet
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | undefined | — | Unique identifier used to connect the component parts. |
ids | ElementIds | undefined | — | Overrides generated identifiers for individual parts. |
trapFocus | boolean | undefined | — | Configures trap focus. |
preventScroll | boolean | undefined | — | Configures prevent scroll. |
modal | boolean | undefined | — | Configures modal. |
initialFocusEl | (() => MaybeElement) | undefined | — | Configures initial focus el. |
finalFocusEl | (() => MaybeElement) | undefined | — | Configures final focus el. |
restoreFocus | boolean | undefined | — | Configures restore focus. |
closeOnInteractOutside | boolean | undefined | true | Configures close on interact outside. |
closeOnEscape | boolean | undefined | true | Configures close on escape. |
role | "dialog" | "alertdialog" | undefined | — | Configures role. |
open | boolean | undefined | — | Whether the component is open when controlled. |
defaultOpen | boolean | undefined | — | Initial open state when uncontrolled. |
onOpenChange | ((details: OpenChangeDetails) => void) | undefined | — | Runs when open changes. |
triggerValue | string | null | undefined | — | Configures trigger value. |
defaultTriggerValue | string | null | undefined | — | Configures default trigger value. |
onTriggerValueChange | ((details: TriggerValueChangeDetails) => void) | undefined | — | Runs when trigger value changes. |
Context, Hooks, and Types
| Export | API |
|---|---|
SheetContext | Render-prop component that exposes component state and actions. |
SheetRootProvider | Provides an externally created API to the component tree. |
useSheet | Creates or accesses the component API. |
useSheetContext | Returns the nearest component API. |
SheetOpenChangeDetails | Type for the details object passed to the matching change callback. |
Angular
React
Solid
Svelte
Vue