Sheet

A flyout that opens from the side of the screen, based on the dialog component.

API Reference

Installation

pnpm dlx cnippet@latest add sheet

Usage

import {
  Sheet,
  SheetContent,
  SheetDescription,
  SheetFooter,
  SheetHeader,
  SheetPanel,
  SheetPopup,
  SheetTitle,
  SheetTrigger,
} from "@/components/ui/sheet"
<Sheet>
  <SheetTrigger>Open</SheetTrigger>
  <SheetPopup>
    <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>
    <SheetPanel>Content</SheetPanel>
    <SheetFooter>
      <SheetClose>Close</SheetClose>
    </SheetFooter>
  </SheetPopup>
</Sheet>

SheetPanel Scrolling

The SheetPanel component automatically wraps its content in a ScrollArea component. This means that if the content exceeds the sheet's maximum height, it will become scrollable automatically. The scrollbar will appear when needed, providing a smooth scrolling experience.

<SheetPanel>
  {/* Long content that will scroll if it exceeds the sheet height */}
  <div>...</div>
</SheetPanel>

SheetPopup Props

The SheetPopup component supports the following props:

  • side: Controls which side of the screen the sheet opens from. Options: "top", "bottom", "left", "right" (default: "right")
  • inset: When true, adds spacing around the sheet on desktop screens (default: false)
// Right side sheet (default)
<SheetPopup side="right">
  ...
</SheetPopup>
 
// Left side sheet
<SheetPopup side="left">
  ...
</SheetPopup>
 
// Top sheet
<SheetPopup side="top">
  ...
</SheetPopup>
 
// Bottom sheet
<SheetPopup side="bottom">
  ...
</SheetPopup>
 
// Sheet with inset spacing
<SheetPopup side="right" inset>
  ...
</SheetPopup>

Examples

Sheet with Inset

Side sheets