feat: add drawer component based on Base UI DrawerPreview#689
Draft
pasqualevitiello wants to merge 46 commits intomainfrom
Draft
feat: add drawer component based on Base UI DrawerPreview#689pasqualevitiello wants to merge 46 commits intomainfrom
pasqualevitiello wants to merge 46 commits intomainfrom
Conversation
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Contributor
Author
|
TODOS:
|
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.
feat: add drawer component based on Base UI DrawerPreview
Summary
Adds a new
Drawercoss UI primitive wrapping Base UI'sDrawerPreview(shipped in v1.2.0) with Tailwind classes. The Drawer is similar to the existing Sheet component but built on a real drawer primitive with native swipe-to-dismiss gestures, snap points, and nested drawer stacking support.Key changes:
@base-ui/reactfrom^1.1.0to^1.2.0drawer.tsxwith the same part structure as Dialog/Sheet (Root, Trigger, Popup, Header, Footer, Title, Description, Panel, etc.)side(right/left/top/bottom),variant(default/inset),showCloseButton, plus pass-through forsnapPoints,open,onOpenChange, etc.packages/uiNote: Base UI exports this as
DrawerPreview(preview API, subject to breaking changes in minor versions). We alias it asDrawerPrimitiveinternally.Updates since last revision
Reworked all transitions to match Base UI's official drawer examples:
450ms cubic-bezier(0.32, 0.72, 0, 1)timing, opacity driven by--drawer-swipe-progressduring swipe,0msduration while swiping (data-swiping), velocity-scaled release via--drawer-swipe-strength450ms cubic-bezier(0.32, 0.72, 0, 1)for transform, CSS variable-driven swipe tracking (--drawer-swipe-movement-x/y,--drawer-snap-point-offset), full off-screen translate for starting/ending styles (e.g.translate-x-full) instead of small 8px shiftsReview & Testing Checklist for Human
bun run dev --filter=ui). None of these were tested in a browser — swipe gestures, snap points, nested drawer stacking, and side positioning all need hands-on verification.translate-x-[var(--drawer-swipe-movement-x)](ortranslate-y-[...]for vertical drawers) directly. If the drawer doesn't track the finger during swipe, confirm Tailwind is correctly compiling these arbitrary value utilities with CSS variables.duration-450 ease-[cubic-bezier(0.32,0.72,0,1)]anddata-ending-style:duration-[calc(var(--drawer-swipe-strength)*400ms)]utilities are complex arbitrary values — confirm they compile and produce smooth open/close/release animations.sideprop design. Thesideprop must be passed in two places:<Drawer side="left">(sets swipeDirection) and<DrawerPopup side="left">(sets visual positioning). This is error-prone. Consider if the rootDrawershould automatically passsidedown via context, or if the docs should clearly warn about this.--nested-drawersCSS variable and scale/opacity stacking work correctly.Test Plan
bun run dev --filter=ui/ui/docs/components/drawerNotes