Skip to content
Overlays Core Stable

Sheet

.md

A modal panel that slides in from an edge of the viewport, for settings, filters, or any focused task that doesn't need a full page

Available for Svelte 5, React, and Vue 3.

Preview

Installation

pnpm add fancy-ui-svelte
import { Sheet } from "fancy-ui-svelte";

Usage

svelte
<script lang="ts">
	import { Sheet } from "fancy-ui-svelte";
	import { Button } from "fancy-ui-svelte";
	import { Switch } from "fancy-ui-svelte";

	let open = $state(false);
	const uid = $props.id();
	const panelId = `${uid}-panel`;
	let notifications = $state(true);
	let compactMode = $state(false);
</script>

<Button
	onclick={() => (open = true)}
	aria-haspopup="dialog"
	aria-expanded={open}
	aria-controls={open ? panelId : undefined}
>
	Open settings
</Button>

<Sheet
	sound
	bind:open
	id={panelId}
	title="Settings"
	description="Update your workspace preferences."
>
	<div class="flex items-center justify-between">
		<span class="text-muted-foreground text-[13px]">Notifications</span>
		<Switch sound bind:checked={notifications} label="Notifications" />
	</div>
	<div class="flex items-center justify-between">
		<span class="text-muted-foreground text-[13px]">Compact mode</span>
		<Switch sound bind:checked={compactMode} label="Compact mode" />
	</div>
</Sheet>

Examples

Basic Usage

Sides

Slide in from any edge of the viewport.

Pin actions below the body.

Props

PropTypeDefaultDescription
open booleanfalseWhether the sheet is open. Bindable
onOpenChange (open: boolean) => void-Called with the new value whenever the sheet opens or closes
side "left" | "right" | "top" | "bottom""right"Edge of the viewport the panel slides in from
title string-Heading rendered in the header and wired to aria-labelledby
description string-Supporting text under the title, wired to aria-describedby
dismissible booleantrueWhether Escape, the scrim and the close button can close the sheet
size "sm" | "md" | "lg""md"Panel width (left/right sides) or height (top/bottom sides)
class string-Additional CSS classes merged onto the panel
id string-The panel's id, for the aria-controls of a trigger rendered outside the component
ref HTMLDivElement | nullnullBindable element reference to the panel
sound booleanfalsePlays close when the sheet is dismissed, once the user has enabled sound

Slots

SlotDescription
children Panel body content
footer Content pinned below the body, e.g. actions