PhoenixKitStaff.Web.Components.TabsStrip (PhoenixKitStaff v0.5.0)

Copy Markdown View Source

daisyUI boxed tab switcher for staff detail pages.

Stateless: the host LiveView owns the active-tab assign and handles @event (dispatched with a %{"tab" => value} payload — keyed tab, not value, to avoid colliding with a <button>'s own empty .value DOM property). Tabs are {value, label, icon} tuples; icon may be nil.

<.tabs_strip
  event="switch_tab"
  active={@active_tab}
  tabs={[
    {"overview", gettext("Overview"), "hero-identification"},
    {"comments", gettext("Comments"), "hero-chat-bubble-left-right"}
  ]}
/>

…and the host handles handle_event("switch_tab", %{"tab" => tab}, …).

Mirrors phoenix_kit_projects' TabsStrip — a candidate for promotion to core PhoenixKitWeb.Components.* once a third module needs it.

Summary

Functions

tabs_strip(assigns)

Attributes

  • event (:string) (required)
  • active (:string) (required)
  • tabs (:list) (required) - list of {value, label, icon} tuples.
  • class (:string) - Defaults to nil.