Skip to content
Esc
↑↓navigate↵open⌘Jpreview
On this page

Sheet for Astro

Astro side panels for secondary tasks and compact navigation.

API Reference

Installation

bunx --bun shadcn@latest add @gnostic/sheet

Usage

import {
    Sheet,
    SheetClose,
    SheetContent,
    SheetDescription,
    SheetFooter,
    SheetHeader,
    SheetTitle,
    SheetTrigger,
} from "@/components/ui/sheet"
<Sheet>
  <SheetTrigger>Open</SheetTrigger>
  <SheetContent>
    <SheetHeader>
      <SheetTitle>Sheet Title</SheetTitle>
      <SheetDescription>Sheet Description</SheetDescription>
    </SheetHeader>
    <SheetFooter>
      <SheetClose variant="outline">Close</SheetClose>
      <Button>Save</Button>
    </SheetFooter>
  </SheetContent>
</Sheet>

Composition

Arrange the parts as shown for a Sheet:

Sheet
├── SheetTrigger
└── SheetContent
    ├── SheetHeader
    │   ├── SheetTitle
    │   └── SheetDescription
    └── SheetFooter

Examples

Sides

API Reference

SheetProps

PropType
defaultOpen?boolean

Initial open state

Typeboolean
closeOnClickOutside?boolean

Close when clicking overlay

Typeboolean
closeOnEscape?boolean

Close when pressing Escape

Typeboolean
lockScroll?boolean

Lock body scroll when open

Typeboolean

SheetContentProps

PropType
side?'top' | 'right' | 'bottom' | 'left'

Screen edge the sheet slides in from.

Type'top' | 'right' | 'bottom' | 'left'
Default"right"
showCloseButton?boolean

Show the close button.

Typeboolean
Defaulttrue

See the data-slot docs for more information on interactivity.

Read the installed source for the complete prop types.

When to use Sheet

Choose a side for SheetContent and compose its title, body, and controls. Use a sheet when the task benefits from an edge panel, such as a filter form or mobile navigation.

Keyboard and behavior

Sheet uses the existing dialog controller for modal behavior. Keep a named close control and test focus return to the trigger. Navigation links inside it still need normal href values.

Theme and layout

The panel shares dialog colors and borders. Check wide content on a narrow screen and give a long body a deliberate scroll region. Side changes affect animation and layout, not application state.