Behavior
Positioning and direction
The drawer can open from any edge. Set the Open Direction prop to control the entry point. Each direction uses its own CSS transforms and border-radius rules.
Bottom (default)
Slides up, rounded top corners, max-height capped
Top
Slides down, rounded bottom corners, accounts for admin bar
Left
Slides in from the left, full-height with rounded corners
Right
Slides in from the right, full-height with rounded corners
Drag-to-close
On open drawers, a pointer drag in the closing direction moves the drawer and dims the overlay proportionally. Releasing past the close threshold (25% of the drawer dimension) closes it — otherwise it snaps back.
Velocity detection — fast swipes close immediately regardless of distance
Over-drag dampening — dragging past the open position applies logarithmic resistance
Scroll awareness — dragging is suppressed for 100ms after scrolling inside the drawer body, preventing scroll-to-close conflicts
Handle-only mode — restrict drag to the
.c-drawer__handleelement with thehandleOnlyoptionNo-drag mode — disable swipe-to-close entirely with the Disable Drag to Close prop
cursor: grabbingis applied globally during drag via.c-drawer--dragging
Snap points
Vertical drawers (top or bottom) can rest at more than one height instead of only open or closed. Add data-snap-point to an element inside the drawer body, and the drawer gets a resting height at that element's edge.
This drawer has three snap points:
The price and Book button.
The dates and guests as well.
Full height, with everything showing.
The value sets which edge of the element the drawer stops at:
"bottom"stops below the element, so the whole element shows."top"stops above the element, so it's the first thing out of view. Use it to stop right before a section starts.
Snap points are numbered by height, not by their order in the markup. The smallest is 1. Full height is always the last snap point, so you don't need to mark it. Edges at the same height count as one snap point.
The drawer opens at snap point 1, and dragging below it closes the drawer. Snap points are ignored for left and right drawers.
Snap navigation buttons
Add data-snap-to to a button inside the drawer to move between snap points on click. This helps visitors who won't drag, or don't know they can.
Step buttons move one snap point at a time:
"next"moves up one snap point."previous"moves down one."toggle"moves up one per click. From full height it goes back to snap point1.
Jump buttons go straight to one snap point:
"first"goes to snap point1."last"goes to full height.A number goes to that snap point.
"#id"goes to the snap point set by thedata-snap-pointelement with that id. It keeps working when you add or reorder snap points, which a number doesn't.
A button with nowhere to go gets aria-disabled="true" and does nothing on click:
next, last
At full height
previous, first
At snap point 1
A number or #id
Already at that snap point, or it doesn't match one
toggle
Never. It sets aria-expanded, which is true at full height
Style the disabled state with [data-snap-to][aria-disabled="true"].
Snap buttons never close the drawer. Use Close Trigger Selector for that.
Use a real
<button>. The component doesn't add keyboard or focus behavior, so a<div>won't work for keyboard or screen reader users.On drawers without snap points,
data-snap-todoes nothing.
Current snap point
While a snap drawer is open, its wrapper has data-snap-index set to the current snap point. Use it to style anything inside the drawer. This flips an arrow at full height in the example above, where booking-drawer is the drawer's Unique ID:
The attribute is removed when the drawer closes.
In JavaScript, listen for drawer:snap. It fires each time the drawer lands on a different snap point, including snap point 1 on open. event.detail.index is the current snap point and event.detail.total is how many there are, including full height.
See Events on the Javascript API page.
Content that changes while open
Snap points re-measure on their own when content loads, grows or shrinks while the drawer is open, like an AJAX form, an image or an accordion. At full height the drawer stays at full height. Otherwise it moves to the snap point closest to what was showing. Changes during a drag wait until the drag is released.
If you need to trigger a re-measure yourself, call drawer.refreshSnapPoints().
Nested drawers
You can open a drawer from inside another drawer. When this happens, the parent scales back slightly while the child opens on top, then restores when the child closes.
A few things to keep in mind:
Passive drawers cannot be nested — they don't participate in the stack.
The child drawer gets its own close gesture and close button. Closing it returns the parent to full size.
You can nest multiple levels deep, but one or two is the practical limit for usability.
Passive mode
Passive mode renders the drawer as a non-modal notification bar. It has no overlay, cannot trap focus, and does not lock body scroll.
Overlay is hidden (CSS managed), body scroll is not locked
Click outside does not close — only drag or a close button dismisses it
Trigger elements do not receive
aria-expandedupdatespointer-events: noneon the wrapper lets users interact with content beneathIdeal for bottom-sheet notifications that don't demand immediate attention
Enable with the Passive Mode prop or the passive constructor option.
Auto-open and persistence
Drawers can open automatically on page load with configurable delay and storage-backed frequency control.
every-visit
Always show (no persistence)
until-dismissed
Show until the user closes it, then never again
once
Show one time only (recorded on open)
after-delay
Re-show after a configurable duration since last dismissal
Duration strings accept 30s, 2h, 7d, or bare numbers (treated as hours). All persistence uses localStorage with keys namespaced under etch-drawer-.
Configure with the Auto Open, Auto Open Delay, Auto Open Reshow, and Auto Open Reshow Delay props.
Etch builder integration
Inside the Etch visual builder iframe, the Drawer disables all gesture handling and event binding. The builder controls open/close via the Show In Builder prop, which toggles visibility on the wrapper element through a MutationObserver.
No drag, no pointer events, no keyboard bindings
CSS rules handle visibility from the prop value
The open/close class toggle still synchronizes
data-statefor preview rendering
Last updated