|
3 | 3 | Your LvieView applications can be made of two layouts: |
4 | 4 |
|
5 | 5 | * the root layout - this is a layout used by both LiveView and |
6 | | - regular views. This layout typically contains the `<html>` |
| 6 | + regular controller views. This layout typically contains the `<html>` |
7 | 7 | definition alongside the head and body tags. Any content defined |
8 | 8 | in the root layout will remain the same, even as you live navigate |
9 | 9 | across LiveViews. The root layout is typically declared on the |
10 | 10 | router with `put_root_layout` and defined as "root.html.heex" |
11 | 11 | in your layouts folder. It calls `{@inner_content}` to inject the |
12 | 12 | content rendered by the layout |
13 | 13 |
|
14 | | - * the app layout - this is the default application layout which |
15 | | - is rendered on both regular HTTP requests and LiveViews. |
16 | | - It defaults to "app.html.heex". This layout is typically set |
17 | | - on `use Phoenix.LiveView, layout: ...` but it has been discouraged |
18 | | - in more recent Phoenix versions, in favor of using explicit function |
19 | | - components as layouts. |
| 14 | + * the app layout - this is the dynamic layout part of your application, |
| 15 | + it often includes the menu, sidebar, flash messages, and more. |
| 16 | + From Phoenix v1.8, this layout is explicitly rendered in your templates |
| 17 | + by calling the `<Layouts.app />` component. In Phoenix v1.7 and earlier, |
| 18 | + the layout was typically configured as part of the `lib/my_app_web.ex` |
| 19 | + file, such as `use Phoenix.LiveView, layout: ...` |
20 | 20 |
|
21 | 21 | Overall, those layouts are found in `components/layouts` and are |
22 | 22 | embedded within `MyAppWeb.Layouts`. |
|
0 commit comments