{# app/templates/shared/macros/tabs.html #} {# Tab navigation components for consistent UI across admin pages #} {# Tab navigation wrapper (standalone) Usage: {% call tabs_nav() %} {{ tab_button('tab1', 'Tab 1', icon='home') }} {{ tab_button('tab2', 'Tab 2', icon='cog') }} {% endcall %} #} {% macro tabs_nav(tab_var='activeTab', class='') %}
{% endmacro %} {# Tab navigation wrapper (inline, for use inside cards/flex containers) Usage:
{% call tabs_inline() %} {{ tab_button('all', 'All', count_var='items.length') }} {% endcall %}
#} {% macro tabs_inline(tab_var='activeTab') %}
{{ caller() }}
{% endmacro %} {# Individual tab button Args: id: Tab identifier (used for activeTab comparison) label: Display text tab_var: Alpine.js variable name for active tab (default: 'activeTab') icon: Optional icon name (uses $icon helper) count_var: Optional Alpine.js variable for count badge onclick: Optional custom click handler (overrides default tab switching) #} {% macro tab_button(id, label, tab_var='activeTab', icon=none, count_var=none, onclick=none) %} {% endmacro %} {# Tab panel wrapper (for content that shows/hides based on active tab) Usage: {{ tab_panel('tab1') }}
Tab 1 content
{{ endtab_panel() }} Or simply use x-show directly:
Content
#} {% macro tab_panel(id, tab_var='activeTab', transition=true) %}
{% endmacro %} {% macro endtab_panel() %}
{% endmacro %}