It’s been a while since we looked at how to handle multiple layouts with Phoenix LiveView - and with the release of Phoenix 1.8, I thought it was time to take another look. In Phoenix apps, we’ve always had two main layouts. The
root.html.heex
static layout. This is the outermost layout that wraps everything in our application. and theapp.html.heex
layout used specifically for LiveViews.We still have both of these layouts in Phoenix 1.8. But if you’re coming from earlier versions of Phoenix, you’ll notice the
app.html.heex
layout has been simplified. Instead of being a separate template file, it’s now a function component that lives right here in the Layout module. This is pretty cool because it means we can treat layouts just like any other component in our application!
continue reading on elixircasts.io
⚠️ This post links to an external website. ⚠️
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.