Sheet
A panel that slides in from an edge of the screen.
Installation
npx shadcn@latest add @oakoss/sheetThis also installs Dialog, whose parts Sheet reuses, and Button.
Usage
import {
Sheet,
SheetBody,
SheetClose,
SheetFooter,
SheetHeader,
SheetTitle,
SheetTrigger,
} from '#/components/ui/overlays/sheet';
<SheetTrigger>
<Button>Open</Button>
<Sheet>
<SheetHeader>
<SheetTitle>Title</SheetTitle>
</SheetHeader>
<SheetBody>Content</SheetBody>
<SheetFooter>
<SheetClose>Done</SheetClose>
</SheetFooter>
</Sheet>
</SheetTrigger>;Examples
Sides
side picks the edge: start and end (the default) follow the page's dir,
and a bottom sheet pads for a phone's home indicator.
Sizes
size (sm, md by default, lg) sets a side sheet's width; top and
bottom sheets span the screen.
Accessibility
Sheet is a Dialog placed against an
edge, with the same naming, focus containment and keys: Escape closes it
unless isKeyboardDismissDisabled is set, and Tab and Shift + Tab wrap inside
it. Like Dialog, a click outside closes it
unless isDismissable is false, and the close button's name comes from
closeLabel. The inner edge keeps a border in Windows High Contrast.
Follows the WAI-ARIA dialog pattern.
API
Sheet
Renders React Aria's ModalOverlay,
Modal and Dialog against an edge. className applies to the panel.
Props
Prop
Type
Also accepts all React Aria ModalOverlay props.
Data attributes
| Attribute | Present when |
|---|---|
data-slot | Always: sheet-overlay, sheet-content (the panel), sheet |
data-side | Always, on the overlay and panel; the side |
data-size | Always, on the panel; the size |
data-entering | The overlay and panel are sliding in |
data-exiting | The overlay and panel are sliding out |
SheetHeader, SheetTitle, SheetDescription, SheetFooter, SheetBody, SheetClose, SheetTrigger
Dialog's parts with sheet-* data-slots (SheetBody keeps dialog-body).
The footer sits at the bottom of the panel.