Skip to content
Overlays Core Stable

Drawer

.md

A modal bottom sheet with a grab handle, draggable shut with a downward swipe — for filters, quick actions, or any touch-first task

Available for Svelte 5, React, and Vue 3.

Preview

Installation

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

Usage

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

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

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

<Drawer sound bind:open id={panelId} title="Filters" description="Drag down to close.">
	<div class="flex flex-col gap-2">
		<label class="text-muted-foreground flex items-center gap-2 text-[13px]">
			<input type="radio" name="sort" value="recent" bind:group={sortBy} />
			Most recent
		</label>
		<label class="text-muted-foreground flex items-center gap-2 text-[13px]">
			<input type="radio" name="sort" value="popular" bind:group={sortBy} />
			Most popular
		</label>
	</div>
</Drawer>

Examples

Basic Usage

With Form

House form fields with a pinned footer.

No Swipe

Disable the drag-to-close gesture.

Props

PropTypeDefaultDescription
open booleanfalseWhether the drawer is open. Bindable
onOpenChange (open: boolean) => void-Called with the new value whenever the drawer opens or closes
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, the close button and the swipe gesture can close the drawer
swipeToClose booleantrueWhether dragging the handle down past the threshold closes the drawer
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 drawer is dismissed, including a committed swipe, once the user has enabled sound

Slots

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