PhoenixKitWeb.Components.Core.AdminPageHeader (phoenix_kit v1.7.208)

Copy Markdown View Source

Provides a unified admin page header component with optional back button, title, subtitle, and action slots.

Replaces the 7+ different header patterns previously used across admin templates, providing a consistent inline flex layout with responsive behavior.

Summary

Functions

Renders an admin page header with title, subtitle, and optional actions.

Functions

admin_page_header(assigns)

Renders an admin page header with title, subtitle, and optional actions.

For simple headers, use title and subtitle attributes. For complex headers with rich content (badges, metadata), use inner_block to provide custom title markup that replaces the default title/subtitle rendering.

Attributes

  • title - Page title as a string attribute
  • subtitle - Page subtitle as a string attribute
  • back - Path to navigate to when the back arrow is clicked. Must already be resolved (e.g. via Routes.path/1 / PhoenixKit.Utils.Routes.path/1) — this renders a plain <.link navigate>, it does NOT re-apply the PhoenixKit URL prefix the way <.pk_link> would. When set, renders a compact ghost back-affordance inline beside the title, aligned to its first line (never on its own row — an icon-only circle by default).
  • back_label - Optional text shown next to the back arrow (from the sm breakpoint up; phones stay icon-only). When omitted the button is a circular icon-only chip (still gets an accessible label + title tooltip).
  • back_click - Deprecated, no-op. Retained so existing callers compile.

Slots

  • :inner_block - Custom title/subtitle markup (overrides title/subtitle attrs)
  • :actions - Action buttons rendered on the right side

Examples

<%!-- Basic --%>
<.admin_page_header title="User Management" />

<%!-- With subtitle --%>
<.admin_page_header title="Settings" subtitle="Configure system" />

<%!-- With a back affordance --%>
<.admin_page_header
  back={Routes.path("/admin/settings/email-sending")}
  back_label="Email Sending"
  title="Send Profiles"
/>

<%!-- With actions --%>
<.admin_page_header title="Posts">
  <:actions>
    <button class="btn btn-primary btn-sm">New Post</button>
  </:actions>
</.admin_page_header>

<%!-- Rich title content --%>
<.admin_page_header>
  <h1 class="text-xl sm:text-2xl lg:text-3xl font-bold text-base-content">Invoice #123</h1>
  <p class="text-sm text-base-content/60 mt-0.5">Created 2 days ago</p>
</.admin_page_header>

Attributes

  • back (:string) - Defaults to nil.

  • back_label (:string) - Defaults to nil.

  • back_click (:string) - Defaults to nil.

  • title (:string) - Defaults to nil.

  • subtitle (:string) - Defaults to nil.

  • class (:string) - Replaces the header's default bottom margin ("mb-3 sm:mb-6") when set — pass e.g. "mb-0" when the page layout controls spacing itself (a flex gap), so margins don't compound.

    Defaults to nil.

Slots

  • inner_block
  • actions