Sheet
Extends the Dialog component to display content that complements the main content of the screen.
Installation
pnpm dlx shadcn@latest add @lumi-ui/sheet
Add the following utilities to your globals.css:
@utility animate-fade-up {
@apply transition-all duration-300 ease-[cubic-bezier(0.25,1,0.5,1)];
&[data-starting-style],
&[data-ending-style] {
opacity: 0;
translate: 0 100%;
}
}
@utility animate-fade-down {
@apply transition-all duration-300 ease-[cubic-bezier(0.25,1,0.5,1)];
&[data-starting-style],
&[data-ending-style] {
opacity: 0;
translate: 0 -100%;
}
}
@utility animate-slide-left {
@apply transition-all duration-300 ease-[cubic-bezier(0.25,1,0.5,1)];
&[data-starting-style],
&[data-ending-style] {
opacity: 0;
translate: 100% 0;
}
}
@utility animate-slide-right {
@apply transition-all duration-300 ease-[cubic-bezier(0.25,1,0.5,1)];
&[data-starting-style],
&[data-ending-style] {
opacity: 0;
translate: -100% 0;
}
}
@utility animate-fade-zoom {
@apply transition-all duration-200 ease-[cubic-bezier(0.25,1,0.5,1)];
&[data-starting-style],
&[data-ending-style] {
opacity: 0;
scale: 0.94;
}
}
@utility animate-fade {
@apply transition-all duration-200;
&[data-starting-style],
&[data-ending-style] {
opacity: 0;
}
}Basic Usage
import {
Sheet,
SheetClose,
SheetDescription,
SheetFooter,
SheetHeader,
SheetContent,
SheetTitle,
SheetTrigger,
} from "@/components/ui/sheet";
export function SheetDemo() {
return (
<Sheet>
<SheetTrigger>Open Sheet</SheetTrigger>
<SheetContent showCloseButton>
<SheetHeader>
<SheetTitle>Are you absolutely sure?</SheetTitle>
<SheetDescription>
This action cannot be undone. This will permanently delete your
account and remove your data from our servers.
</SheetDescription>
</SheetHeader>
<SheetFooter>
<SheetClose>Cancel</SheetClose>
<SheetClose>Continue</SheetClose>
</SheetFooter>
</SheetContent>
</Sheet>
);
}Anatomy
<Sheet>
<SheetTrigger />
<SheetContent>
<SheetHeader>
<SheetTitle />
<SheetDescription />
</SheetHeader>
<SheetFooter>
<SheetClose />
</SheetFooter>
</SheetContent>
</Sheet>Variants
API reference
Sheet component uses Dialog component under the hood, see here for details