Skip to main content

Beautiful drawers for Svelte 5

A powerful drawer component library with gesture-driven animations, snap points, and full accessibility support

Quick start

Get up and running with Svelte Drawer in minutes

1

Install the package

Install Svelte Drawer using your preferred package manager:
npm install @abhivarde/svelte-drawer
2

Import components

Import the drawer components into your Svelte 5 application:
import { Drawer, DrawerOverlay, DrawerContent, DrawerHandle } from '@abhivarde/svelte-drawer';
3

Create your first drawer

Add a basic drawer to your component:
<script>
  import { Drawer, DrawerOverlay, DrawerContent, DrawerHandle } from '@abhivarde/svelte-drawer';

  let open = $state(false);
</script>

<button onclick={() => open = true}>
  Open Drawer
</button>

<Drawer bind:open>
  <DrawerOverlay class="fixed inset-0 bg-black/40" />
  <DrawerContent class="fixed bottom-0 left-0 right-0 bg-white rounded-t-lg p-4">
    <DrawerHandle class="mb-8" />
    <h2>Drawer Content</h2>
    <p>This is a drawer component.</p>
    <button onclick={() => open = false}>Close</button>
  </DrawerContent>
</Drawer>

Key features

Everything you need to build beautiful drawer experiences

Gesture-driven dragging

Smooth animations with mouse and touch support for natural interactions

Multiple directions

Open drawers from bottom, top, left, or right with automatic handle orientation

Snap points

iOS-like multi-height drawers that snap to predefined positions

Prebuilt variants

Sheet, dialog, sidebar, and minimal variants ready to use

Portal rendering

Escape z-index conflicts by rendering in a portal

Keyboard accessible

Full keyboard navigation and focus management built-in

Persistent state

Save drawer state across page reloads automatically

TypeScript support

Comprehensive type definitions for all components and props

Explore by topic

Learn how to use Svelte Drawer in your projects

Guides

Step-by-step guides for common use cases

Examples

Real-world examples to get you started

API Reference

Complete API documentation for all components

Ready to get started?

Start building beautiful drawer experiences in your Svelte 5 applications today

Get Started

Build docs developers (and LLMs) love