mui / material-ui

Material UI: Ready-to-use foundational React components, free forever. It includes Material UI, which implements Google's Material Design.
https://mui.com/material-ui/
MIT License
92.51k stars 31.88k forks source link

Support for bottom sheets from Material Design specs #18783

Open blake-mealey opened 4 years ago

blake-mealey commented 4 years ago

Summary 💡

It would be great to have an implementation of the Bottom sheet component from the 2019 Material Design specs (https://material.io/components/sheets-bottom/#). I didn't see an issue for it already so I figured I'd create this one to get the conversation started. I'd be potentially interested in helping to create that implementation, though not in the immediate future.

The specs break the component down into three types, which each have pretty distinct behaviour:

  1. Standard bottom sheets
  1. Modal bottom sheets
  1. Expanding bottom sheets

I don't think it's necessary to provide a component for Standard bottom sheets, since this can already be achieved very easily, however it would be useful to have components for Modal bottom sheets and Expanding bottom sheets. Since they quite different, I think they should be separate components. I am more interested in the Modal bottom sheets which I have seen used much more in real applications and I think has more use cases, so I think that work should be considered a higher priority.

Since the specs don't give much direction on the visuals of the modal sheet, I think that should be completely left to the user, and only the behaviour should be implemented. Perhaps, with the exception of an optional bar element (not sure what to call it, see screenshots).

P.S. maybe we could call the bar element a "handle bar" or "handle" ?

Examples 🌈

Motivation 🔦

I think these are a really useful component which I've been seeing more and more in modern apps and I find are delightful to use. They are a great way to make options available to mobile users since it keeps things accessible to the thumbs at the bottom of the screen. It also helps to keep context with the activity you were in before opening the sheet. I would like to use something like this in one of my projects in the future.

I think the most complex part of implementing a bottom sheet is the swiping interactions and making them nice and fluid. If they don't work well, it loses much of its magic and delight-fullness. This is why I think it should be part of mui core, so that it is easy for developers to add a bottom sheet with solid behaviour with little effort.

oliviertassinari commented 4 years ago

@blake-mealey What's missing from the bottom drawer? https://material-ui.com/components/drawers/#swipeable-temporary-drawer

Note that most of our audience use React to write desktop dashboards & admins.

blake-mealey commented 4 years ago

Oh shoot, I did not see that component, thought I had checked everywhere to make sure you didn't already have this.

However, it isn't 100% what I need - I'm looking for the swipe up for fullscreen behaviour as well.

Your point about the audience of the framework is an interesting one, since I am using it for building a mobile-centered web app, and so my needs are definitely quite different from a desktop dashboard.

How difficult do you think it would be to extend the "swipeable temporary drawer" to include the fullscreen behaviour as a one-off for my project? Would it be easier for me to create a new component or start with the existing one?

oliviertassinari commented 4 years ago

Your point about the audience of the framework is an interesting one, since I am using it for building a mobile-centered web app, and so my needs are definitely quite different from a desktop dashboard.

I have seen most developers go with Flutter (Dart). I have personally started working on Material-UI for https://splitme.net/, a mobile app 🤷‍♂️.


Yes, you are right, the bottom sheet is different. I think that it would be interesting to support it. I would suspect we need a new component. Still, the logic will likely be close to the swipeable temporary drawer.

In #11546, you can find a hacky solution to support the backdrop. Flutter has an implementation it might be interesting to benchmark with.

r3dm1ke commented 4 years ago

A couple of use-cases from Material design spec where drawer probably would not be sufficient:

image

image

image

I think key features that drawer does not have are:

And, slightly offtopic, there is a proposal to material design spec for side sheets

r3dm1ke commented 4 years ago

@oliviertassinari is that something that we would want to implement in the lab? If yes, I d open a draft PR so we can move the discussion/benchmarking there

oliviertassinari commented 4 years ago

@r3dm1ke Yes, I think that we can iterate on it in the lab :). However, I would be cautious not to have the core team invest too much time on it because:

ianaz commented 3 years ago

Tried to get it to work as well using SwipeableDrawer (variant=temporary) by changing properties of the nested react-transition-group, but in the end it seem we need a change in code as I couldn't find any way to make react-transaition-group have a "min-height" or something. Any other suggestion?

Is it possible to put bounties on material-ui's issues?

solaiagam commented 2 years ago

Would like to see this on the lab or atleast a hacky version of Swipeable drawer.

arpu commented 1 year ago

could this be done with the modal mui implementation?