Sheet
Slide-in drawer panel from any edge. Supports backdrop, keyboard dismiss, and multiple sizes.
import { Sheet } from "phoundry-ui";Right Sheet (Default)
Loading interactive example…
View source
<script lang="ts"> import { Sheet } from "phoundry-ui"; import { Button } from "phoundry-ui";
let rightOpen = $state(false);</script>
<Button onclick={() => (rightOpen = true)}>Open Right Sheet</Button><Sheet open={rightOpen} onclose={() => (rightOpen = false)} title="Details"> <div class="space-y-3 text-sm"> <p>This sheet slides in from the right edge.</p> <p class="text-txt-secondary"> It's great for detail panels, settings, or secondary content. </p> </div></Sheet>Left Sheet
Loading interactive example…
View source
<script lang="ts"> import { Sheet } from "phoundry-ui"; import { Button } from "phoundry-ui";
let leftOpen = $state(false);</script>
<Button onclick={() => (leftOpen = true)}>Open Left Sheet</Button><Sheet open={leftOpen} onclose={() => (leftOpen = false)} side="left" title="Navigation"> <div class="space-y-3 text-sm"> <p>Left sheets work well for navigation or sidebars.</p> </div></Sheet>Top Sheet
Loading interactive example…
View source
<script lang="ts"> import { Sheet } from "phoundry-ui"; import { Button } from "phoundry-ui";
let topOpen = $state(false);</script>
<Button onclick={() => (topOpen = true)}>Open Top Sheet</Button><Sheet open={topOpen} onclose={() => (topOpen = false)} side="top" size="lg" title="Notifications"> <div class="space-y-3 p-1 text-sm"> <p> <code>side="top"</code> / <code>bottom</code> map <code>size</code> to height instead of width. </p> </div></Sheet>Full width column
Loading interactive example…
View source
<script lang="ts"> import { Sheet } from "phoundry-ui"; import { Button } from "phoundry-ui";
let fullOpen = $state(false);</script>
<Button variant="outline" onclick={() => (fullOpen = true)} >Open full-width sheet</Button><Sheet open={fullOpen} onclose={() => (fullOpen = false)} side="right" size="full" title="Wide panel"> <div class="p-4 text-sm text-txt-secondary"> <code>size="full"</code> stretches to the opposing edge. </div></Sheet>Modal-like dismissal
Loading interactive example…
View source
<script lang="ts"> import { Sheet } from "phoundry-ui"; import { Button } from "phoundry-ui";
let modalLikeOpen = $state(false);</script>
<Button variant="secondary" onclick={() => (modalLikeOpen = true)} >Open guarded sheet</Button><Sheet open={modalLikeOpen} onclose={() => (modalLikeOpen = false)} closeOnBackdrop={false} title="Confirm"> <div class="space-y-3 px-4 pb-4 text-sm"> <p class="text-txt-secondary"> Users cannot dismiss accidentally-, require an explicit action. </p> <Button size="sm" onclick={() => (modalLikeOpen = false)} >Acknowledge</Button > </div></Sheet>Bottom Sheet
Loading interactive example…
View source
<script lang="ts"> import { Sheet } from "phoundry-ui"; import { Button } from "phoundry-ui";
let bottomOpen = $state(false);</script>
<Button onclick={() => (bottomOpen = true)}>Open Bottom Sheet</Button><Sheet open={bottomOpen} onclose={() => (bottomOpen = false)} side="bottom" size="sm" title="Quick Actions"> <div class="space-y-3 text-sm"> <p> Bottom sheets are useful for mobile-style action menus or compact content. </p> </div></Sheet>API
From phoundry-ui@0.4.21
| Name | Type | Default | Description |
|---|---|---|---|
openrequired | boolean | — | Whether the sheet is visible. |
oncloserequired | () => void | — | Called when the sheet should close. |
side | SheetSide | 'right' | Which edge the sheet slides from. |
size | SheetSize | 'md' | Sheet width (left/right) or height (top/bottom). |
title | string | '' | Header title text. |
closeOnBackdrop | boolean | true | Close when clicking the backdrop. |
closeOnEscape | boolean | true | Close on Escape key. |
showCloseButton | boolean | true | Show the X close button in the header. |
class | string | '' | Additional CSS classes for the sheet panel. |
childrenrequired | Snippet<[]> | — | Sheet body content. |
Usage tips
- Use
side="right"for detail panels,side="left"for navigation, andside="bottom"for mobile-style menus. - Set
closeOnBackdrop=falsefor sheets with unsaved form data to prevent accidental dismissal. - The
sizeprop controls width for left/right sheets and height for top/bottom sheets (sm–xlmap to px presets,fullfills the axis). showCloseButton={false}hides the header close control - still provide another dismiss affordance whencloseOnEscapeis left enabled.- Uses
role="dialog"andaria-modal="true"; add your own focus trap if the sheet contains complex interactive widgets.
CSS styling
.ph-sheet is the stable identification hook for Sheet. Part selectors and --_ph-* properties are internal. Component CSS is scoped and unlayered; Consumer classes remain additive and utility overrides may lose precedence.
data-side and data-size select the existing panel geometry. Preset widths/heights are sm 17.5rem, md 25rem, lg 35rem, xl 45rem, and full 100%. These panel presets are distinct from the control-height scale.
Keep the shared component stylesheet and a named Theme imported. Decorative motion respects reduced-motion preferences.