ComponentsOverlays
Sheet
A panel that slides in from an edge. A swipeable bottom sheet on phones.
A panel that slides in from an edge. A swipeable bottom sheet on phones.
<Sheet>
<SheetTrigger asChild>
<Button variant="outline">Open sheet</Button>
</SheetTrigger>
<SheetContent>
<SheetHeader>
<SheetTitle>Project settings</SheetTitle>
<SheetDescription>Slides in from the right.</SheetDescription>
</SheetHeader>
</SheetContent>
</Sheet>The same component at all four levels. Pick the one that fits your project; they share tokens, so they mix.
npm i junco @junco/tailwindimport { Sheet, SheetTrigger, SheetContent, SheetHeader, SheetTitle, SheetDescription, SheetFooter, SheetClose } from "junco";
<Sheet>
<SheetTrigger asChild>
<Button variant="outline">Filters</Button>
</SheetTrigger>
<SheetContent side="right">
<SheetHeader>
<SheetTitle>Filters</SheetTitle>
<SheetDescription>Narrow down the list.</SheetDescription>
</SheetHeader>
{/* content */}
<SheetFooter>
<SheetClose asChild><Button>Apply</Button></SheetClose>
</SheetFooter>
</SheetContent>
</Sheet>Resize the window below 640px: the side sheet turns into a bottom sheet with a drag handle.
Sheet#opendefaultOpenonOpenChange| Prop | Type | Default |
|---|---|---|
openControlled open state. | boolean | – |
defaultOpenInitial open state when uncontrolled. | boolean | false |
onOpenChangeCalled when the sheet opens or closes, including after a swipe. | (open: boolean) => void | – |
SheetContent#sidemobileSideshowClosecloseLabelclassNames| Prop | Type | Default |
|---|---|---|
sideThe edge it slides in from. | "right" | "left" | "top" | "bottom" | "right" |
mobileSideUnder 640px, side sheets become swipeable bottom sheets. same keeps the side. | "bottom" | "same" | "bottom" |
showCloseShow the × button. | boolean | true |
closeLabelAccessible name for the × button. | string | "Close" |
classNamesClass overrides for each part. | { overlay?, content?, handle?, close? } | – |
SheetTitle#isHidden| Prop | Type | Default |
|---|---|---|
isHiddenVisually hidden, still read by screen readers. | boolean | false |
| Key | Action |
|---|---|
| Esc | Closes the sheet and returns focus to the trigger. |
| Tab | Cycles focus inside the sheet. |