Repository navigation
feat(lab): add BottomSheet (snap points, swipe-to-dismiss, grab handle) - #4468
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
Replace the snapPoints/detent model and the boolean feature toggles with a
single named height scale ('short' | 'medium' | 'tall' | 'auto'), and switch
the close callback to onOpenChange for Dialog parity. The sheet is now always
modal with an always-present grab handle and swipe-to-dismiss, matching the
established bottom-sheet pattern. Drops snapPoints, snapIndex, onSnapChange,
size, hasDragHandle, hasSwipeToDismiss, hasScrim, and hasCloseButton.
…heet Move the visible sheet surface (background, top-corner radius, width cap) onto the wrapper that carries the drag translate, and make the underlying <dialog> transparent. Previously the white panel lived on the dialog while only the inner content translated, so the surface stayed fixed during a swipe. Round the top corners with --radius-page and cap the sheet at 640px centered so it does not stretch edge to edge on tablets.
cixzhang
marked this pull request as ready for review
July 29, 2026 19:02
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
BottomSheetcomponent to the lab package — a mobile touch surface that rises from the bottom edge with a grab handle and swipe-to-dismiss.How
Built on top of the existing
lab/Drawer<dialog>engine (Drawer side="bottom") rather than forking it — Drawer ownsshowModal(), the open/close slide animation, the LIFO overlay stack, focus trap + restore, scroll lock, and the Escape/scrim contract. BottomSheet layers the grab handle + drag-to-dismiss on top, inside the dialog. One dialog engine, no fork, and Drawer's public API is unchanged.The drag/dismiss machinery lives in a small hook kept internal to BottomSheet (colocated, not exported from lab's public entry). The behavior is sheet-specific — a dismiss edge on a bottom-anchored surface — so it stays private rather than shipping as a general primitive.
API
Controlled and modal, mirroring
Dialog:isOpen/onOpenChange(isOpen)— caller owns the open statelabel— required accessible nameheight— named scale:'short'(peek) ·'medium'(half viewport, default) ·'tall'(near-full) ·'auto'(fits content, capped at the tall budget)The sheet is always modal, always has a grab handle, and always supports swipe-to-dismiss. Escape and a downward swipe both request close, so the gesture has a keyboard equivalent. Bottom content is padded with
env(safe-area-inset-bottom)to clear the home indicator.Risk
Additive — new lab component, no changes to existing exports or Drawer. Lab is pre-1.0 and unversioned, so no changeset.
Testing
pnpm vitest run packages/lab/src/BottomSheet/— 15 pass (10 component + 5 gesture hook)pnpm --filter @astryxdesign/lab typecheck— cleanReference #575.