Skip to content

feat(lab): add BottomSheet (snap points, swipe-to-dismiss, grab handle) - #4468

Merged
cixzhang merged 4 commits into
mainfrom
feat/lab-bottomsheet
Jul 29, 2026
Merged

cixzhang merged 4 commits into
mainfrom
feat/lab-bottomsheet

Conversation

@cixzhang

@cixzhang cixzhang commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds a BottomSheet component 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 owns showModal(), 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 state
  • label — required accessible name
  • height — 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 — clean
  • eslint — clean
  • 3 Storybook stories: filters (default), a tall list, and an auto-height form

Reference #575.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 28, 2026
@vercel

vercel Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jul 29, 2026 6:54pm

Request Review

@github-actions

github-actions Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.7KB 0B

Accessibility Audit

Status: 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.
github-actions Bot added a commit that referenced this pull request Jul 29, 2026
@cixzhang
cixzhang marked this pull request as ready for review July 29, 2026 19:02
@cixzhang
cixzhang merged commit 56a87ea into main Jul 29, 2026
22 checks passed
@github-actions
github-actions Bot deleted the feat/lab-bottomsheet branch July 30, 2026 06:57

This branch was successfully deployed

1 active deployment
Preview — d82f2645 Deployed Jul 29, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant