Skip to main content

Basic Drawer

The most straightforward implementation of Svelte Drawer. This example demonstrates a bottom drawer with basic open/close functionality and a drag handle.

What This Example Shows

  • Simple drawer trigger button
  • Bottom drawer with overlay
  • Drag handle for gesture control
  • Basic open/close state management

Code Example

Key Features

  • Overlay: Semi-transparent background with bg-black/40 opacity
  • Rounded corners: Top corners rounded with rounded-t-lg
  • Drag handle: Visual indicator that the drawer can be dragged
  • State binding: Uses bind:open for two-way state management

Usage Notes

  • Click the overlay to close the drawer
  • Press Escape to close (enabled by default)
  • Drag the handle or content area to dismiss
  • The drawer animates smoothly on open/close