Sheet
LayoutSlide-out panel from any edge. Used for mobile menus and detail views.
Responsive viewport — resize the window to explore. Direction and density apply only to this preview. Theme applies to the docs too.
"use client";
import {
Sheet,
SheetTrigger,
SheetContent,
SheetHeader,
SheetTitle,
SheetDescription,
SheetFooter,
SheetClose,
} from "@dashboardpack/core/components/ui/sheet";
import { Button } from "@dashboardpack/core/components/ui/button";
import { Input } from "@dashboardpack/core/components/ui/input";
import { Label } from "@dashboardpack/core/components/ui/label";
import { useState } from "react";
export default function SheetExample() {
const [side, setSide] = useState<"left" | "right" | "top" | "bottom">(
"right",
);
return (
<div className="space-y-4">
<div className="flex flex-wrap gap-2">
{(["left", "right", "top", "bottom"] as const).map((edge) => (
<Button
key={edge}
size="sm"
variant={side === edge ? "secondary" : "ghost"}
onClick={() => setSide(edge)}
>
{edge}
</Button>
))}
</div>
<Sheet>
<SheetTrigger asChild>
<Button variant="outline">Edit profile</Button>
</SheetTrigger>
<SheetContent side={side}>
<SheetHeader>
<SheetTitle>Edit profile</SheetTitle>
<SheetDescription>
Try editing your name. This example does not persist changes.
</SheetDescription>
</SheetHeader>
<div className="space-y-2 p-4">
<Label htmlFor="sheet-name">Display name</Label>
<Input id="sheet-name" defaultValue="Alex Morgan" />
</div>
<SheetFooter>
<SheetClose asChild>
<Button>Done</Button>
</SheetClose>
</SheetFooter>
</SheetContent>
</Sheet>
</div>
);
}Usage
Use Sheet for supporting details or editing alongside a page. Choose a physical side on SheetContent. The side prop does not automatically swap left and right in RTL.
import {
Sheet,
SheetTrigger,
SheetContent,
SheetHeader,
SheetTitle,
SheetDescription,
SheetFooter,
SheetClose,
} from "@dashboardpack/core/components/ui/sheet";Available in the included @dashboardpack/core package. Copy the complete example from Source code for all imports and state. Add "use client" when using hooks or event handlers. See installation and theming for project setup.
API reference
Common props and defaults. Slot-specific props are named below; native elements also accept their standard HTML attributes. The component TypeScript definitions are the complete type reference.
| Prop | Type / Default | Description |
|---|---|---|
| side (SheetContent) | left | right | top | bottomDefault: right | Physical screen edge. |
| open / defaultOpen | booleanDefault: false | Controlled or initial open state. |
| onOpenChange | (open: boolean) => voidDefault: — | Handle dismissal and opening. |
| asChild (SheetTrigger / SheetClose) | booleanDefault: false | Use your own single child control. |