Sheet
Extends the Dialog to display content that complements the main content of the screen.
Installation
pnpm dlx cubix@latest add sheetUsage
import {
Sheet,
SheetClose,
SheetContent,
SheetDescription,
SheetFooter,
SheetHeader,
SheetTitle,
SheetTrigger,
} from "@/components/cubix/sheet"<Sheet>
<SheetTrigger>Open</SheetTrigger>
<SheetContent>
<SheetHeader>
<SheetTitle>Are you absolutely sure?</SheetTitle>
<SheetDescription>This action cannot be undone.</SheetDescription>
</SheetHeader>
</SheetContent>
</Sheet>Composition
Use the following composition to build a Sheet:
Sheet
├── SheetTrigger
└── SheetContent
├── SheetHeader
│ ├── SheetTitle
│ └── SheetDescription
└── SheetFooterSide
Use the side prop on SheetContent to set the edge of the screen where the sheet appears. Values are top, right, bottom, or left.
No Close Button
Use showCloseButton={false} on SheetContent to hide the close button.
API Reference
Sheet is built on the Dialog primitive. See also the Base UI Dialog documentation for additional props.
Sheet
| Prop | Type | Default | Description |
|---|---|---|---|
| open | boolean | - | Controlled open state. Omit to use uncontrolled mode. |
| defaultOpen | boolean | false | Initial open state when uncontrolled. |
| onOpenChange | (open: boolean) => void | - | Called when the open state changes. |
| children | React.ReactNode | - | The trigger and sheet content. |
SheetTrigger
| Prop | Type | Default | Description |
|---|---|---|---|
| render | React.ReactElement | - | Compose the trigger onto a child element such as Button (Base UI). |
| asChild | boolean | - | Compose the trigger onto a child element such as Button (Radix UI). |
| children | React.ReactNode | - | The trigger content. |
SheetContent
| Prop | Type | Default | Description |
|---|---|---|---|
| side | "top" | "right" | "bottom" | "left" | "right" | Edge of the screen where the sheet appears. |
| showCloseButton | boolean | true | Whether to show the close button in the top-right corner. |
| className | string | - | Additional Tailwind classes merged with the component styles (last one wins). |
| children | React.ReactNode | - | Header, body, and footer content of the sheet. |
SheetHeader / SheetFooter
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | - | Additional Tailwind classes merged with the component styles (last one wins). |
| children | React.ReactNode | - | Content for the header or footer region. |
SheetTitle / SheetDescription
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | - | Additional Tailwind classes merged with the component styles (last one wins). |
| children | React.ReactNode | - | Accessible title or description text. |