How to specify a different root layout in phoenix_liveview 0.16.4?

I am migrating from Phoenix 1.5 / Phoenix LiveView 0.15 to Phoenix 1.6 / Phoenix LiveView 0.16.4.
Now I face the following problem.

In my router I had one specific live view with a different root layout.

live "/dummy", DummyLive, layout: "other_root.html"

With the new version, the compiler complaints:

== Compilation error in file lib/bw_web/router.ex ==
** (ArgumentError) unknown live option :layout.

Supported options include: :container, :as, :metadata, :private.

So, the layout option seems to be removed, but what is the alternative?
How do I specify a different root layout for specific liveviews?

1 Like

as a workaround I would copy the live_view function in your app_web.ex, e.g. to live_view_special_layout and would set the preferred layout there

and, of course, adapt the use AppWeb, :live_view_special_layout

2 Likes

The Phoenix LiveView Live layouts Guide goes over all of the available options as well.

1 Like
live_session :admin, root_layout: {AppWeb.LayoutView, "root_admin.html"} do
  live "/...", MyLive
end
3 Likes

Thanks for the suggestions.
Both the live_view function in _web.ex and the options in the Live layouts Guide aim at using a different live.html though.

But I would like to use a different root.html.

The Live layouts Guide is actually contradicting. The paragraph on “the root layout” mentions

The root layout is typically declared on the router with put_root_layout and defined as “root.html.heex” in your MyAppWeb.LayoutView . It may also be given via the :layout option to the router’s live macro.

But the latter option is what is actually been removed in the latest version!

Just cross-posted. Will try that now.

Thanks, that works!