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.
Open your
drawer.jsonfile in a text editor or IDE and copy its entire contents.In Etch navigate to the page you want to work on
Paste the json you copied
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
navigate to the "Drawer Patterns" folder in your download file
Open the json file of the pattern you would like to use (examples here.)
Copy the contents of that json file
Paste the contents into Etch
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
