PhoenixKitWeb.Components.Dashboard.TabItem (phoenix_kit v1.7.38)

Copy Markdown View Source

Tab item component for dashboard navigation.

Renders individual tabs with support for:

  • Icons and labels
  • Badges and indicators
  • Active state highlighting
  • Attention animations
  • External links
  • Tooltips
  • Presence indicators

Summary

Functions

Renders a mobile-friendly tab item for bottom navigation.

Checks if a path already contains a locale prefix (e.g., /uk/, /en/, /zh-Hans/). Returns true if the path starts with a locale pattern.

Renders the inner content of a tab (icon, label, badge, presence).

Renders a dashboard tab item.

Functions

mobile_tab_item(assigns)

Renders a mobile-friendly tab item for bottom navigation.

Attributes

  • tab (:any) (required)
  • active (:boolean) - Defaults to false.
  • locale (:string) - Defaults to nil.
  • class (:string) - Defaults to "".

path_has_locale_prefix?(path)

Checks if a path already contains a locale prefix (e.g., /uk/, /en/, /zh-Hans/). Returns true if the path starts with a locale pattern.

tab_content(assigns)

Renders the inner content of a tab (icon, label, badge, presence).

Attributes

  • tab (:any) (required)
  • active (:boolean) - Defaults to false.
  • viewer_count (:integer) - Defaults to 0.
  • compact (:boolean) - Defaults to false.
  • is_subtab (:boolean) - Defaults to false.
  • subtab_style (:map) - Defaults to %{}.

tab_item(assigns)

Renders a dashboard tab item.

Attributes

  • tab - The Tab struct
  • active - Whether this tab is currently active
  • viewer_count - Number of users viewing this tab (optional)
  • locale - Current locale for path generation
  • compact - Render in compact mode (icon only)
  • class - Additional CSS classes

Examples

<.tab_item tab={@tab} active={@tab.active} />
<.tab_item tab={@tab} active={true} viewer_count={3} />

Attributes

  • tab (:any) (required)
  • active (:boolean) - Defaults to false.
  • viewer_count (:integer) - Defaults to 0.
  • locale (:string) - Defaults to nil.
  • compact (:boolean) - Defaults to false.
  • class (:string) - Defaults to "".
  • parent_tab (:any) - Defaults to nil.