-
-
Notifications
You must be signed in to change notification settings - Fork 353
[drawer] Create new Drawer / Sheet component #3680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
commit: |
Bundle size report
Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
8e7cd0d to
38aae58
Compare
|
any idea when this will ship? I need a drawer component fairly soon but I can always use vaul in the meantime |
|
@piehouserat probably in v1.2.0 release around mid-February |
|
A neat feature would be to use a CloseWatcher to allow closing the drawer with the Android 'back' swipe gesture. This can make drawers and modals feel much more native. The browser support is Chromium only at the moment (I think?) but I usually feature detect it and fall back to an |
7f95c7b to
534f9c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@atomiks Really cool!
I don't know if you already need feedback, maybe not, but since I'm the only one? on Android, I thought I could have a quick play on my phone, and compare with Material UI:
- It's impossible to close the drawer, starting outside of the Popup:
VID_20260117_152111.mp4
Vaul has the same problem. But on Android, all the native apps, e.g., Google Drive supports it. It works "correctly" with Material UI. I'm used to it at this point. The value for end-users is not having to put any mental energy in think where to place your finger to start the dismissal interaction.
- It's possible to extend the drawer to infinity, it shouldn't:
VID_20260117_151449.mp4
I guess it's an Android-only issue, that we are good on iOS, we only have this issue because we want to have resistance when going in the wrong direction, and it's a bit trickier in Android to make it work.
- The close interaction feels too sensitive. I felt I had "cancelled" my interaction, I barely retracted the drawer, but still, it closed it:
VID_20260117_182008.mp4
We could have short interactions like this to close the drawer, but then it should take into account the velocity of the movement; this is the approach used in Material UI.
Otherwise:
- I created a start of a benchmark page https://www.notion.so/mui-org/core-Drawer-Sheet-2ebcbfe7b66080a68150cdc9e0b0ac20, to help copy the best stuff that is out there.
- In #38, linked to the relevant Shadcn issues: helps us understand a bit what those folks need (the key bugs from Vaul) and help folks find our solution.
|
@oliviertassinari thanks for all those points, very helpful - they should be addressed in the latest update |
115dc22 to
71cca0e
Compare
Swipe from outside to dismiss
This one is controversial. There's value in not having it dismiss too, so the backdrop is a safe zone for swiping (cleaning dust off your screen or whatever). But the biggest issue is that the Drawer should feel native, and iOS does not work like this. So we should either revert this, or detect the OS and have different behaviour for each. Swipe area to openOn YT, you can swipe a specific area of the viewport to open the Drawer, which is a nice touch. We should add this to be feature-complete. Screen.Recording.2026-01-27.at.07.12.21.mov |
Interesting, I was coming from the Android side, pushing on the "feel native" direction + upside of the approach. |
@colmtuite turns out iOS isn't consistent here. Yesterday I was using Maps and it has a Drawer component that does exactly what we're doing in this PR. Honestly, it feels the best/most natural to me and allows you to sloppily swipe from above, which feels the most intuitive. Maybe it's intentionally context-dependent for some reason? |
7e5c737 to
b82f306
Compare
Interesting. I can't seem to find another iOS drawer that works like this. But yeah ok, I guess the question now is do we make it configurable (and only apply the option to iOS)? Have you looked at how this works in Swift, and how to configure it?
|
b7e6007 to
6aad7b1
Compare
d8e7192 to
9f0bdf7
Compare
I would not make it configurable unless requested. It doesn't seem like it's configurable and Maps uses a "custom" sheet:
I would say it's not controversial though, it's probably something 99% of people don't even notice in iOS to begin with |
474f006 to
55536a8
Compare
|
This is looking fantastic, just been playing around with it on Android Chrome and it's looking and feeling great. Thank you for adding the CloseWatcher support! |
|
The CloseWatcher is so good. Tweet material right there. Having it supported in the drawer makes me feel like its missing everywhere now. The dialogs, the docs search, the docs nav But it will take me a long time before trusting UIs that I can use the back button on a webpage and it won't go to the previous URL. A website having it would actually probably mess me up (train me to bad habits, I would want to close a dialog to the action, and instead load the previous page, and lose what I was typing in a form, nooo), it would make me want to expect all websites to have it, or have it disabled in the few that have it. Maybe because |
| }, [drawerId, open, providerContext]); | ||
|
|
||
| React.useEffect(() => { | ||
| // CloseWatcher enables the Android back swipe gesture (Chromium-only). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends on how people configure it. It's a back button or a back swipe.
| // CloseWatcher enables the Android back swipe gesture (Chromium-only). | |
| // CloseWatcher enables the Android back gesture (Chromium-only). |
I think it's my favourite recent web API addition, but I know what you mean about it being a bit confusing. It's being adopted slowly and there's no way for users to tell if a site supports it. I've added it to the site I look after at work as our users are 85% mobile and I imagine the Android users are used to being able to swipe back. |
44941eb to
02f79d8
Compare

Closes #38
Preview: https://deploy-preview-3680--base-ui.netlify.app/react/components/drawer