Slots in new Phoenix component based layouts?

I’m using the latest Phoenix 1.7 RC with layouts based on Phoenix.Component.

Is it possible to define optional slots in Live layouts?
(I’d like an optional :banner slot available for any LiveView of my application)

I don’t think the layouts mechanism supports slots. I’d probably make the layout a function component instead and use no layout, but wrap pages in

  <:banner> … </:banner>
1 Like


This was my workaround, I guess I will stick with it then!

I have now 3 levels of layout in my application, it’s a bit overkill :sweat_smile:

You could skip app.html if you have everything in your <.layout> component.

1 Like

I agree that I could
I won’t (because reasons), but I could :stuck_out_tongue: