Layout components for Pure Admin.
Provides the full page structure: navbar, layout wrapper, sidebar, main content, and footer.
Summary
Functions
Renders a visual divider/separator.
Renders the footer with three-section layout.
Inline script that reads persisted UI preferences from localStorage and applies the corresponding classes before the page paints, preventing a flash of unstyled content.
Renders the main layout container (below navbar).
Renders the layout content wrapper.
Renders the layout inner container (sidebar + content).
Renders the main content area.
Renders the top navbar.
Renders the brand/logo section in the navbar.
Renders the burger menu button for sidebar toggle.
Renders a dropdown menu for a navbar_nav_item.
Renders a navigation link group in the navbar.
Renders a navigation item within navbar_nav.
Renders the profile button in the navbar.
Renders the search widget in the navbar.
Renders the page title in the navbar center section.
Renders a single notification item within notifications.
Renders a notifications bell button with dropdown panel.
Renders a hidden input containing the page context as JSON.
Renders a content section with optional heading.
Renders the sidebar navigation.
Renders a sidebar menu item (link).
Renders a collapsible sidebar submenu item.
JS command to toggle the notifications panel.
JS command to toggle the sidebar visibility.
JS command to toggle a submenu open/closed.
Functions
Renders a visual divider/separator.
Attributes
class(:string) - Defaults tonil.- Global attributes are accepted.
Inline script that reads persisted UI preferences from localStorage and applies the corresponding classes before the page paints, preventing a flash of unstyled content.
default_mode is the mode used on first visit, when localStorage has no
theme-mode entry yet. Must be "light", "dark", or "auto". "auto"
resolves to light/dark via prefers-color-scheme at runtime.
Examples
<.fouc_prevention_script />
<.fouc_prevention_script default_mode="auto" />Attributes
default_mode(:string) - Defaults to"light". Must be one of"light","dark", or"auto".
Renders the main layout container (below navbar).
Examples
<.layout>
<.sidebar>...</.sidebar>
<.main>...</.main>
<.footer>...</.footer>
</.layout>Attributes
id(:string) - Defaults tonil.class(:string) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)
Renders the layout content wrapper.
Attributes
class(:string) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)
Renders the layout inner container (sidebar + content).
Attributes
class(:string) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)
Renders the main content area.
Attributes
class(:string) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)
Renders a single notification item within notifications.
Examples
<.notification_item variant="success" icon="fa-solid fa-check">
<:title>Build completed</:title>
<:text>Production deployment finished</:text>
<:time>15 minutes ago</:time>
</.notification_item>Attributes
variant(:string) - Defaults tonil.Must be one ofnil,"primary","secondary","success","warning","danger", or"info".icon(:string) - Icon class (e.g. 'fa-solid fa-check'). Defaults tonil.is_unread(:boolean) - Defaults tofalse.class(:string) - Defaults tonil.- Global attributes are accepted.
Slots
title- Notification title.text- Notification body text.time- Timestamp text.
Renders a notifications bell button with dropdown panel.
Examples
<.notifications count={3}>
<.notification_item variant="primary" icon="fa-solid fa-file-pen">
<:title>New task assigned</:title>
<:text>Review the Q4 report by end of week</:text>
<:time>2 minutes ago</:time>
</.notification_item>
</.notifications>Attributes
id(:string) - Defaults to"notifications".count(:integer) - Badge count (nil = no badge). Defaults tonil.class(:string) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block- Notification items.footer_- Footer content (e.g. 'View all' link).
Renders a hidden input containing the page context as JSON.
JS hooks read this synchronously via getPageContext() instead of
fetching from APIs. CSP-safe (no inline scripts with data).
Examples
<.page_context />
<.page_context extra={%{"user" => %{"id" => 1}}} />Attributes
extra(:map) - Additional context to merge (from app assigns). Defaults to%{}.- Global attributes are accepted.
Renders a content section with optional heading.
Examples
<.section title_text="My Section">
Section content here.
</.section>Attributes
title_text(:string) - Section heading text (renders as h3). Defaults tonil.class(:string) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)
Renders the sidebar navigation.
Examples
<.sidebar>
<.sidebar_item href="/" icon="📊" label="Dashboard" is_active />
<.sidebar_item href="/users" icon="👥" label="Users" />
</.sidebar>Attributes
id(:string) - Defaults to"sidebar".is_sticky(:boolean) - Defaults tofalse.is_icon_collapse(:boolean) - Defaults tofalse.is_resizable(:boolean) - Defaults tofalse.class(:string) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)
Renders a sidebar menu item (link).
Examples
<.sidebar_item href="/dashboard" icon="📊" label="Dashboard" is_active />Attributes
href(:string) - Defaults to"#".icon(:string) - Icon text, emoji, or HTML. Defaults tonil.label(:string) (required)is_active(:boolean) - Defaults tofalse.class(:string) - Defaults tonil.- Global attributes are accepted. Supports all globals plus:
["phx-click", "navigate", "patch"].
@spec toggle_notifications(String.t()) :: Phoenix.LiveView.JS.t()
JS command to toggle the notifications panel.
@spec toggle_sidebar(String.t()) :: Phoenix.LiveView.JS.t()
JS command to toggle the sidebar visibility.