Design system / Molecules
Molecule / Disclosure
Sheet
Sheet uses Radix Dialog primitives to display a modal panel from a selected edge. The caller supplies content and its workflow. Panel disclosure and focus remain separate from navigation or persistence.
Live example
Current component with fictional data. Example changes are not persisted.
Responsibility
The edge panel provides one modal-disclosure contract using Radix Dialog. Navigation or editing content retains its own state and commands. The side prop selects placement, not product behavior.
Public contract
The table describes supported inputs, exported parts and caller responsibilities. A callback supplies a command, such as saving a draft. These notes are maintained manually; check current source types before integration.
| Prop / part | Type | Requirement | Responsibility |
|---|---|---|---|
| open / defaultOpen / onOpenChange | Radix Dialog Root props | Optional | Sheet inherits Dialog mechanics. |
| side | top | right | bottom | left | Content · default right | Edge presentation; left/right source width is three quarters, capped at sm. |
| showCloseButton | boolean | Content · default true | Accessible corner Close is included unless disabled. |
| container | Element | DocumentFragment | null | Content · optional | Portal owner. Supply an element within a scoped theme so the modal panel and overlay inherit that theme. Omit for the default body portal. |
| children / className | Part props | Assembly | Provide Title, Description, Header and optional Footer. |
API notes are curated documentation, not generated types. The source linked above is the current implementation; update these notes alongside API changes.
State and behavior
Identify which values the caller controls and which behavior the component or underlying primitive owns. A local example does not supply persistence, authorization or a complete product lifecycle.
No navigation or persistence logic in this file. Radix handles modal open/focus; consumers supply any navigation, form or operation.
Dependencies
- Radix Dialog primitives, aliased as SheetPrimitive
- Portal and Overlay
- Lucide X
- cn()
Token and styling contract
These notes identify theme roles, utilities and direct style values used by the source. Direct colors or timings are implementation exceptions, not recommendations to bypass the theme.
bg-background / text-foreground- Panel and title roles.
bg-black/50 / z-50 / shadow-lg- Overlay and layering.
duration-500 open / duration-300 closed- Actual source timings, preserved by the live preview.
Boundaries and limitations
- Source entrance is 500ms. Primitive motion tokens do not automatically govern these component timings; inspect reduced-motion behavior when evolving the source.
- Disabling the corner close requires another explicit exit.
- Modal content and permission checks remain separate responsibilities.
Where to make a change
Change generic edge-container presentation in sheet.tsx. Keep mobile navigation state and content in Sidebar or feature controllers. Preserve naming, focus return and reduced-motion treatment when evolving source.
Selected real uses
Sidebar
Uses Sheet primitives in its mobile branch. Sidebar has its own responsive state and Context; Sheet does not decide navigation policy.
src/components/ui/sidebar.tsxThese traces describe selected uses, not every dependency. Repository-only paths are shown as references; only approved files have public source views.
Usage contract
import { Sheet, SheetTrigger, SheetContent, SheetHeader, SheetTitle } from "@/components/ui/sheet";
<Sheet><SheetTrigger>Read panel</SheetTrigger>
<SheetContent side="right"><SheetHeader><SheetTitle>Context</SheetTitle></SheetHeader>{content}</SheetContent>
</Sheet>Illustrative consumer bindings, not a self-contained product workflow. Live examples supply only local state or explicit fictional props.