Sheet
Web/MobileExtends the Dialog to display content that complements the main content of the screen.
Installation
pnpm dlx cubix-ui@latest add sheet --base radixUsage
import { Button } from "@/components/cubix/button"
import { TextField, TextFieldInput, TextFieldLabel } from "@/components/cubix/text-field"
import {
Sheet,
SheetClose,
SheetContent,
SheetFooter,
SheetHeader,
SheetTitle,
SheetTrigger,
} from "@/components/cubix/sheet"
<Sheet>
<SheetTrigger render={<Button variant="outline" size="sm" />}>ویرایش پروفایل</SheetTrigger>
<SheetContent>
<SheetHeader>
<SheetTitle>ویرایش پروفایل</SheetTitle>
</SheetHeader>
<div className="grid gap-4 px-4">
<TextField>
<TextFieldLabel>نام و نام خانوادگی</TextFieldLabel>
<TextFieldInput placeholder="امین ابدالی" />
</TextField>
<TextField>
<TextFieldLabel>نام کاربری</TextFieldLabel>
<TextFieldInput placeholder="@amin" />
</TextField>
</div>
<SheetFooter>
<Button type="submit">
ذخیره تغییرات
</Button>
<SheetClose render={<Button variant="outline" />}>بستن</SheetClose>
</SheetFooter>
</SheetContent>
</Sheet>
Composition
Use the following composition to build a Sheet:
Sheet
├── SheetTrigger
└── SheetContent
├── SheetHeader
│ ├── SheetTitle
│ └── SheetDescription
├── …content
└── SheetFooter
├── Button
└── SheetCloseExamples
Side
Use the side prop on SheetContent to set the edge of the screen where the sheet appears. Values are top, right, bottom, or left.
Custom styling
Pass className on SheetHeader and SheetFooter to drop the divider lines and muted footer background.
Without built-in close
Set showCloseButton={false} on SheetContent to hide the built-in X button and provide your own.
API Reference
Note: Sheet is built on the Dialog primitive. It moves focus to its panel when it opens, traps focus, and dismisses on Escape or backdrop click. Use the same props on Base UI, React Aria, and Radix.
Sheet
The container that wraps the trigger and content and manages open state.
| 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 / SheetClose
The elements that open and close the sheet. Compose both with Cubix Button via render.
| Prop | Type | Default | Description |
|---|---|---|---|
| render | React.ReactElement | - | Render the trigger or close control as another Cubix element (e.g. a Button). |
| className | string | - | Additional Tailwind classes merged with the component styles (last one wins). |
SheetContent
The sliding panel rendered with a backdrop.
| Prop | Type | Default | Description |
|---|---|---|---|
| side | "top" | "right" | "bottom" | "left" | "right" | Edge of the screen where the sheet appears. |
| showCloseButton | boolean | true | Show the built-in close (X) button in the top end corner. |
| dir | "ltr" | "rtl" | "rtl" | Text direction of the portaled panel. Defaults to RTL for Persian-first layouts. |
| lang | string | "fa" | Language attribute applied when dir is "rtl". Pass dir="ltr" to omit it. |
| className | string | - | Additional Tailwind classes merged with the component styles (last one wins). |
SheetHeader / SheetFooter
Layout regions of the sheet content.
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | - | Additional Tailwind classes merged with the component styles (last one wins). |
SheetTitle / SheetDescription
The title and supporting text of the sheet.
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | - | Additional Tailwind classes merged with the component styles (last one wins). |