# `PhoenixKitWeb.Components.LayoutWrapper`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.165/lib/phoenix_kit_web/components/layout_wrapper.ex#L1)

Dynamic layout wrapper component for Phoenix v1.7- and v1.8+ compatibility.

This component automatically detects the Phoenix version and layout configuration
to provide seamless integration with parent applications while maintaining
backward compatibility.

## Usage

Replace direct layout calls with the wrapper:

    <%!-- OLD (Phoenix v1.7-) --%>
    <%!-- Templates relied on router-level layout config --%>

    <%!-- NEW (Phoenix v1.8+) --%>
    <PhoenixKitWeb.Components.LayoutWrapper.app_layout flash={@flash}>
      <%!-- content --%>
    </PhoenixKitWeb.Components.LayoutWrapper.app_layout>

## Configuration

Configure parent layout in config.exs:

    config :phoenix_kit,
      layout: {MyAppWeb.Layouts, :app}

# `app_layout`

Renders content with the appropriate layout based on configuration and Phoenix version.

Automatically handles:
- Phoenix v1.8+ function component layouts
- Phoenix v1.7- legacy layout configuration
- Fallback to PhoenixKit layouts when no parent configured
- Parent layout compatibility with PhoenixKit assigns

## Attributes

- `flash` - Flash messages (required)
- `phoenix_kit_current_scope` - Current authentication scope (optional)
- `phoenix_kit_current_user` - Current user (optional, for backwards compatibility)

## Inner Block

- `inner_block` - Content to render within the layout

## Attributes

* `flash` (`:map`) - Defaults to `%{}`.
* `socket` (`:any`) - Defaults to `nil`.
* `phoenix_kit_current_scope` (`:any`) - Defaults to `nil`.
* `phoenix_kit_current_user` (`:any`) - Defaults to `nil`.
* `page_title` (`:string`) - Defaults to `nil`.
* `page_subtitle` (`:string`) - Defaults to `nil`.
* `current_path` (`:string`) - Defaults to `nil`.
* `inner_content` (`:string`) - Defaults to `nil`.
* `project_title` (`:string`) - Defaults to `nil`.
* `current_locale` (`:string`) - Defaults to `nil`.
* `from_layout` (`:boolean`) - Defaults to `false`.
* `pk_pending_invitations` (`:list`) - Defaults to `[]`.
* `module_assigns` (`:map`) - Module-supplied host-consumable assigns. Each key in this map is merged into the assigns set passed to the parent layout (`Layouts.app`), so a host's custom layout can read e.g. `assigns[:phoenix_kit_publishing_translations]` from publishing, or any other module-defined key. Plain `conn.assigns` don't reach a function-component layout — only declared attrs do — so this single map attribute is how modules thread arbitrary host-consumable data through the boundary without core having to declare each one explicitly. Defaults to `%{}`.
## Slots

* `inner_block`

# `build_locale_url`

# `generate_language_switch_url`

# `get_language_flag`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
