PureAdmin.Components.Profile (PureAdmin v1.1.0)

Copy Markdown View Source

Profile panel components for Pure Admin.

Provides a slide-out profile panel with user info, avatar, navigation, and optional tabs/footer.

Summary

Functions

JS command to close the profile panel.

Renders a navigation item within the profile panel.

Renders a profile panel with overlay.

JS command to toggle the profile panel open/closed.

Functions

close_profile_panel(id \\ "profile-panel")

@spec close_profile_panel(String.t()) :: Phoenix.LiveView.JS.t()

JS command to close the profile panel.

profile_nav_item(assigns)

Renders a navigation item within the profile panel.

Examples

<.profile_nav_item href="/settings" icon="fa-solid fa-gear">Settings</.profile_nav_item>

Attributes

  • href (:string) - Defaults to "#".
  • icon (:string) - Icon class. Defaults to nil.
  • class (:string) - Defaults to nil.
  • Global attributes are accepted. Supports all globals plus: ["navigate", "patch"].

Slots

  • inner_block (required)

profile_panel(assigns)

Renders a profile panel with overlay.

Examples

<.profile_panel id="profile" name="John Doe" email="john@example.com" role="Admin">
  <:nav>
    <.profile_nav_item href="/profile" icon="fa-solid fa-user">Profile Settings</.profile_nav_item>
    <.profile_nav_item href="/security" icon="fa-solid fa-lock">Security</.profile_nav_item>
  </:nav>
  <:footer_>
    <button class="pa-btn pa-btn--danger pa-btn--block">Sign Out</button>
  </:footer_>
</.profile_panel>

Attributes

  • id (:string) - Defaults to "profile-panel".
  • name (:string) (required) - User display name.
  • email (:string) (required) - User email.
  • role (:string) - User role badge text. Defaults to nil.
  • has_avatar (:boolean) - Show avatar section. Defaults to true.
  • has_icon_only_tabs (:boolean) - Tabs show only icons. Defaults to false.
  • class (:string) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • avatar - Custom avatar content (default: user icon).
  • tabs - Tabs section between header and body.
  • nav - Navigation items in the body.
  • actions - Action buttons in the body (deprecated, use footer_).
  • footer_ - Fixed footer content (e.g. sign out button).
  • inner_block - Full body content (replaces nav+actions when using tabs).

toggle_profile_panel(id \\ "profile-panel")

@spec toggle_profile_panel(String.t()) :: Phoenix.LiveView.JS.t()

JS command to toggle the profile panel open/closed.