Sheet
A modal workspace attached to a viewport edge, with persistent task actions.
Interactive preview
Changes stay in this local demonstration.
Installation
Add editable source to an initialized React project. Set up antiflex/ui first if you are new here.
npx antiflex-ui@0.1.0-alpha.2 add sheetThis site previews the latest workspace styles and motion. The published alpha keeps its released styles until the next npm release.
Usage
<Sheet>
<SheetTrigger>Edit settings</SheetTrigger>
<SheetContent side="right" size="md">
<SheetHeader>
<SheetTitle>Workspace settings</SheetTitle>
<SheetDescription>Update your workspace.</SheetDescription>
</SheetHeader>
<SheetBody>Settings form or review content</SheetBody>
<SheetFooter><SheetClose>Done</SheetClose></SheetFooter>
</SheetContent>
</Sheet>API reference
All components forward native attributes, className, and refs to their underlying elements.
| Prop | Type | Default |
|---|---|---|
Root: open / defaultOpen / onOpenChange | boolean / boolean / (open: boolean) => void | uncontrolled, closed |
Content: size | sm | md | lg | md |
Content: initialFocusRef / returnFocusRef | RefObject<HTMLElement | null> | first focusable / invoker |
Content: dismissOnOutside | boolean | true |
Trigger / Close | ButtonProps, native button ref | primary / secondary |
Content: side | top | right | bottom | left (physical edges) | right |
Accessibility
Uses native modal HTML dialog with inert background, nested scroll locks, Tab/Shift+Tab loop, Escape dismissal, and focus restored to the invoker or returnFocusRef. Provide one Title or explicit aria-label/aria-labelledby, one optional short Description, and a visible Close action. initialFocusRef must point to a visible descendant; focus Title and set aria-describedby="" for long structured reading. Controlled consumers must honor onOpenChange to dismiss. Outside dismissal requires both press and release on the backdrop; set dismissOnOutside=false to disable it. Native onCancel can prevent Escape. Content stays mounted while closed, so reset drafts on opening if needed. Root has no DOM/ref. Content forwards native dialog attributes/events and its HTMLDialogElement ref; Header/Body/Footer div, Title h2, Description p, Trigger/Close button. Keep Header, Body, Footer as direct children of Content or of one direct form; Body scrolls while header and footer remain visible. Keep headings/descriptions concise on short viewports. No portal, legacy dialog polyfill, swipe, drag, or snap points are included. Side sheets fill the viewport height. Horizontal sheets fill its width. Size selects 360/448/640px width or 320/480/640px height, capped to the viewport. Left and right are physical and do not swap in RTL; text, controls, and logical spacing inherit direction.