How to create a responsive burger menu with LiveView?

Are there any web apps on github or tutorials that have implemented a responsive burger menu with Phoenix LiveView?

Would it be better to use javascript instead due to the client-side nature of a responsive menu?

I would say it is better to keep that toggled state not in your LV and do it with JS. You can accomplish this fairly easily with JS Commands.

You would do the exact same as that tutorial except you wont need to use custom JS. You can use toggle/1

4 Likes

It’s possible to do this relying completely on CSS without a single line of JS. For example this is what daisyUI does with its drawer component (or all their components for that matter). I find the approach very powerful as it allows for easy integration with any framework.

2 Likes