Skip to main content

sheet

Extends the Dialog component to display content that complements the main content of the screen.

Philosophy

Sheets are dialogs that slide in from the edge — they maintain spatial context better than centered modals. Use them for supplementary content (settings panels, detail views, mobile navigation) where the user needs to reference what's behind the overlay. The side prop makes the direction of information flow explicit.

How It's Built

Loading diagram...

Installation


npx @gentleduck/cli add sheet

npx @gentleduck/cli add sheet

Usage

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

Examples

Side

Use the side property to <SheetContent /> to indicate the edge of the screen where the component will appear. The values can be top, right, bottom or left.

Size

You can adjust the size of the sheet using CSS classes:

<Sheet>
  <SheetTrigger>Open</SheetTrigger>
  <SheetContent className="w-[400px] sm:w-[540px]">
    <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>
  </SheetContent>
</Sheet>
<Sheet>
  <SheetTrigger>Open</SheetTrigger>
  <SheetContent className="w-[400px] sm:w-[540px]">
    <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>
  </SheetContent>
</Sheet>

Component Composition

Loading diagram...

API Reference

Sheet

PropTypeDefaultDescription
defaultOpenbooleanfalseInitial open state for uncontrolled usage
openboolean--Controlled open state
onOpenChange(open: boolean) => void--Callback when open state changes
modalbooleantrueEnables modal focus/interaction behavior
childrenReact.ReactNode--Sheet sub-components (SheetTrigger, SheetContent, etc.)
...propsReact.ComponentPropsWithoutRef<typeof SheetPrimitive.Root>--Additional props inherited from SheetPrimitive.Root

SheetTrigger

PropTypeDefaultDescription
asChildbooleanfalseRenders child as trigger element instead of a default button
childrenReact.ReactNode--Trigger content
...propsReact.ComponentPropsWithoutRef<typeof SheetPrimitive.Trigger>--Additional props inherited from SheetPrimitive.Trigger

SheetPortal

PropTypeDefaultDescription
containerHTMLElement--Optional portal container
forceMounttrue--Forces mounted state for all portal children
...propsReact.ComponentPropsWithoutRef<typeof SheetPrimitive.Portal>--Additional props inherited from SheetPrimitive.Portal

SheetOverlay

PropTypeDefaultDescription
classNamestring--Additional CSS class names
...propsReact.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>--Additional props inherited from SheetPrimitive.Overlay

SheetContent

PropTypeDefaultDescription
side'top' | 'right' | 'bottom' | 'left''right'The side from which the sheet slides in
closeTextstring'Close'Screen-reader label for the built-in close button
classNamestring--Additional CSS class names
childrenReact.ReactNode--Sheet content
...propsReact.ComponentPropsWithoutRef<typeof SheetPrimitive.Content> & VariantProps<typeof sheetVariants>--Additional props inherited from SheetPrimitive.Content and the local sheetVariants

SheetContent renders a built-in close button in the top-right corner.

SheetHeader

PropTypeDefaultDescription
classNamestring--Additional CSS class names
...propsReact.HTMLAttributes<HTMLDivElement>--Additional props to spread to the header container

SheetFooter

PropTypeDefaultDescription
classNamestring--Additional CSS class names
...propsReact.HTMLAttributes<HTMLDivElement>--Additional props to spread to the footer div

SheetTitle

PropTypeDefaultDescription
classNamestring--Additional CSS class names
...propsReact.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>--Additional props inherited from SheetPrimitive.Title

SheetDescription

PropTypeDefaultDescription
classNamestring--Additional CSS class names
...propsReact.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>--Additional props inherited from SheetPrimitive.Description

SheetClose

PropTypeDefaultDescription
asChildbooleanfalseRenders child as close control
childrenReact.ReactNode--Close control content
...propsReact.ComponentPropsWithoutRef<typeof SheetPrimitive.Close>--Additional props inherited from SheetPrimitive.Close

RTL Support

See also

  • Dialog — Centered modal overlay
  • Drawer — Bottom drawer overlay, great for mobile