Bottom Sheet
The lean bottom-only build: pointer dragging, velocity dismissal, scroll-aware gesture policy, safe-area spacing.
v2.0.2@magic-spells/bottom-sheet
Live demo
Scrolling hands off to dragging.
About
Accessible bottom-sheet custom elements built on @magic-spells/dialog-panel. The sheet keeps modal behavior in the native `` layer and adds Pointer Events dragging, velocity dismissal, scroll-aware gesture policy, and safe-area spacing.
Features
- Pointer Events gestures work with mouse, touch, and pen
- Fast downward flicks dismiss without a long drag
- Optional snap points through snap-points, driven by height so the footer stays pinned at every snap
- Scrollable content hands the gesture to the panel mid-drag, the moment the list runs out
- Optional detached, fully rounded presentation through inset
- Upward drags use a restrained rubber-band transform
Usage
<button id="open-sheet">Open sheet</button>
<dialog-panel id="sheet-panel">
<dialog aria-labelledby="sheet-title">
<bottom-sheet>
<bottom-sheet-header>
<h2 id="sheet-title">A useful title</h2>
<button data-action-hide-dialog aria-label="Close">×</button>
</bottom-sheet-header>
<bottom-sheet-content>
<p>Scrollable sheet content goes here.</p>
</bottom-sheet-content>
<bottom-sheet-footer>
<button>Primary action</button>
</bottom-sheet-footer>
</bottom-sheet>
</dialog>
</dialog-panel>
<script type="module">
const trigger = document.querySelector('#open-sheet');
const sheet = document.querySelector('bottom-sheet');
trigger.addEventListener('click', () => sheet.show(trigger));
</script>About, features, usage and options are taken from the package README.