Sheet for Astro
Astro side panels for secondary tasks and compact navigation.
Installation
bunx --bun shadcn@latest add @gnostic/sheetnpx shadcn@latest add @gnostic/sheetpnpm dlx shadcn@latest add @gnostic/sheetInstall component packages
bun add @data-slot/dialognpm install @data-slot/dialogpnpm add @data-slot/dialogCopy the files
src/components/ui/sheet/index.tssrc/components/ui/sheet/sheet-close.astrosrc/components/ui/sheet/sheet-content.astrosrc/components/ui/sheet/sheet-description.astrosrc/components/ui/sheet/sheet-footer.astrosrc/components/ui/sheet/sheet-header.astrosrc/components/ui/sheet/sheet-title.astrosrc/components/ui/sheet/sheet-trigger.astrosrc/components/ui/sheet/sheet.astrosrc/components/ui/sheet/types.ts
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
defaultOpen?boolean
Initial open state
booleancloseOnClickOutside?boolean
Close when clicking overlay
booleancloseOnEscape?boolean
Close when pressing Escape
booleanlockScroll?boolean
Lock body scroll when open
booleanSheetContentProps
side?'top' | 'right' | 'bottom' | 'left'
Screen edge the sheet slides in from.
'top' | 'right' | 'bottom' | 'left'"right"showCloseButton?boolean
Show the close button.
booleantrueSee 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.