oakoss/ui
Components

Sheet

A panel that slides in from an edge of the screen.

SourceReact Aria

Installation

npx shadcn@latest add @oakoss/sheet

This 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

AttributePresent when
data-slotAlways: sheet-overlay, sheet-content (the panel), sheet
data-sideAlways, on the overlay and panel; the side
data-sizeAlways, on the panel; the size
data-enteringThe overlay and panel are sliding in
data-exitingThe 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.