Skip to content

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
right-sheet-default.svelte
<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
left-sheet.svelte
<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
top-sheet.svelte
<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
full-width-column.svelte
<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>

Loading interactive example…

View source
modal-like-dismissal.svelte
<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
bottom-sheet.svelte
<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

NameTypeDefaultDescription
openrequiredboolean—Whether the sheet is visible.
oncloserequired() => void—Called when the sheet should close.
sideSheetSide'right'Which edge the sheet slides from.
sizeSheetSize'md'Sheet width (left/right) or height (top/bottom).
titlestring''Header title text.
closeOnBackdropbooleantrueClose when clicking the backdrop.
closeOnEscapebooleantrueClose on Escape key.
showCloseButtonbooleantrueShow the X close button in the header.
classstring''Additional CSS classes for the sheet panel.
childrenrequiredSnippet<[]>—Sheet body content.

Usage tips

  • Use side="right" for detail panels, side="left" for navigation, and side="bottom" for mobile-style menus.
  • Set closeOnBackdrop=false for sheets with unsaved form data to prevent accidental dismissal.
  • The size prop controls width for left/right sheets and height for top/bottom sheets (sm–xl map to px presets, full fills the axis).
  • showCloseButton={false} hides the header close control - still provide another dismiss affordance when closeOnEscape is left enabled.
  • Uses role="dialog" and aria-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.

Documentation is licensed under CC BY 4.0. Phoundry names and marks remain reserved.