Phoenix.LiveComponent doesn’t take layout: as an option.
I’m not sure of the structure of your app, but what you could do in order to not copy paste the flash html code around would be to wrap your livecomponents in a function that takes a slot.
Using the embed_templates macro, you can then call live.html.heex as a HEEx tag, i.e.
<.live>
</.live>
Otherwise I would just copy paste it into a HEEx function within a module that is accessible within your live components:
slot :inner_block
def container(assigns) do
~H"""
<main class="container">
<p class="alert alert-info" role="alert"
phx-click="lv:clear-flash"
phx-value-key="info"><%= live_flash(@flash, :info) %></p>
# other flashes
<%= render_slot(@inner_block) %>
</main>
"""
end






















