emilkowalski / vaul

An unstyled drawer component for React.
https://vaul.emilkowal.ski
MIT License
5.27k stars 170 forks source link

Drawer modal not hiding on resize #302

Open gtandes opened 3 months ago

gtandes commented 3 months ago

Good day. I am trying to make Drawer display only on mobile screens and hide it if the user manually resizes their screen to 450px+.

Is that possible? If so, what property / properties do I need to change?

mrnmilutinovic commented 2 months ago

@gtandes I believe what you described is not the responsibility of Vaul.

On the other hand you should be able to solve this by conditionally rendering your components, or perhaps rendering something else when on desktop/mobile.

You could use something like useMediaQuery hook (check that here) to determine is you are on mobile and render based on that. Here is the working version of the on shadcn