shadcn.io is not affiliated with official shadcn/ui
Installation
bunx --bun shadcn@latest add https://kit.dev/r/aria/sheet.jsonnpx shadcn@latest add https://kit.dev/r/aria/sheet.jsonpnpm dlx shadcn@latest add https://kit.dev/r/aria/sheet.jsonyarn shadcn@latest add https://kit.dev/r/aria/sheet.jsonThis component depends on Button. Install it first if you haven't already.
Install the following dependencies:
bun add react-aria-components tailwind-variants lucide-reactnpm install react-aria-components tailwind-variants lucide-reactpnpm add react-aria-components tailwind-variants lucide-reactyarn add react-aria-components tailwind-variants lucide-reactCopy and paste the following code into your project.
"use client";
import { XIcon } from "lucide-react";
import type React from "react";
import {
Heading,
ModalOverlay as ModalOverlayPrimitive,
type ModalOverlayProps as ModalOverlayPrimitiveProps,
Modal as ModalPrimitive,
Dialog as SheetPrimitive,
DialogTrigger as SheetTriggerPrimitive,
type DialogTriggerProps as SheetTriggerPrimitiveProps,
} from "react-aria-components";
import { cn } from "@/lib/utils";
import { Button, type ButtonProps } from "@/registry/aria/components/button";
export const SheetTrigger = (props: SheetTriggerPrimitiveProps) => (
<SheetTriggerPrimitive data-slot="sheet-trigger" {...props} />Update the import paths to match your project setup.
Anatomy
SheetTrigger
SheetOverlay
SheetPositioner
SheetContent
SheetTitle
SheetDescription
SheetCloseUsage
import { Button } from "@/components/ui/button";
import { Field, FieldLabel } from "@/components/ui/field";
import { Input } from "@/components/ui/input";
import {
Sheet,
SheetClose,
SheetContent,
SheetDescription,
SheetFooter,
SheetHeader,
SheetTitle,
SheetTrigger,
} from "@/components/ui/sheet";<Sheet>
<SheetTrigger asChild>
<Button variant="outline">Open</Button>
</SheetTrigger>
<SheetContent>
<SheetHeader>
<SheetTitle>Edit profile</SheetTitle>
<SheetDescription>
Make changes to your profile here. Click save when you're done.
</SheetDescription>
</SheetHeader>
<div className="grid flex-1 auto-rows-min gap-6 px-4">
<Field className="grid gap-3">
<FieldLabel>Name</FieldLabel>
<Input defaultValue="Pedro Duarte" type="text" />
</Field>
<Field className="grid gap-3">
<FieldLabel>Username</FieldLabel>
<Input defaultValue="@peduarte" type="text" />
</Field>
</div>
<SheetFooter>
<Button type="submit">Save changes</Button>
<SheetClose asChild>
<Button variant="outline">Close</Button>
</SheetClose>
</SheetFooter>
</SheetContent>
</Sheet>Accessibility
| Key | Description |
|---|---|
Enter | Activate the focused control. |
Space | Activate the focused control. |
Demos
Side
Use the side prop on SheetContent to set the edge of the screen where the sheet appears.
No Close Button
Use showCloseButton={false} on SheetContent to hide the close button.
Rtl
Right-to-left sheet. See the RTL configuration guide for document direction.
API Reference
Sheet
PropType
childrenReact.ReactNodeAttributeType
SheetTrigger
PropType
childrenReact.ReactNodeclassName?stringAttributeType
SheetClose
PropType
childrenReact.ReactNodeAttributeType
SheetOverlay
PropType
childrenReact.ReactNodeAttributeType
SheetContent
PropType
childrenReact.ReactNodeclassName?stringSheetHeader
PropType
childrenReact.ReactNodeAttributeType
SheetFooter
PropType
childrenReact.ReactNodeAttributeType
SheetTitle
PropType
childrenReact.ReactNodeSheetDescription
PropType
childrenReact.ReactNode