Page cover
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Setup

A gesture-driven drawer component for Etch. Supports swipe-to-close, nested stacking, non-modal notifications, and four directions. Built with vanilla JS — no framework required.


What it does

  • Slides in from any edge: top, bottom, left, or right

  • Swipe-to-close with velocity detection and over-drag dampening

  • Nested stacking — open a drawer from inside another drawer

  • Passive (non-modal) mode for notification-style UI

  • Auto-open on page load with configurable delay and frequency control

  • Fully accessible — keyboard nav, focus trap, screen reader announcements

How to Import

1. Import Drawer

First, import the drawer component to get the component loaded in your etch site.

  1. Open your drawer.json file in a text editor or IDE and copy its entire contents.

  2. In Etch navigate to the page you want to work on

  3. Paste the json you copied

  4. Move the drawer below your drawer trigger in the DOM so the drawer opening JS works correctly.

2. Import Drawer Patterns

The drawer comes with a few premade patterns to get you started

  1. navigate to the "Drawer Patterns" folder in your download file

  2. Open the json file of the pattern you would like to use (examples here.)

  3. Copy the contents of that json file

  4. Paste the contents into Etch

  5. Move the drawer below your drawer trigger in the DOM so the drawer opening JS works correctly.

Customizing

Drawers initialize automatically on page load. For most use cases, set props Component Props in the Etch builder and you're done.

To change its CSS styling see Custom CSS for the options available.

To control a drawer from custom code, grab its instance from the DOM:

See the Javascript API for the full reference.

Last updated