TabGroup

Organism

Accessible tab navigation following the role="tablist" / role="tab" / role="tabpanel" ARIA pattern. Arrow-key navigation; tabIndex=-1 on inactive tabs. Tabs take order and a per-tab lazy; isolate renders function contents inside try/catch so one failing contributed tab shows a placeholder instead of taking the page down.

Default

Preview

Overview panel content.

Code
<%- include('modules/ui/TabGroup', {
  tabs: [
    { id: 'overview', label: 'Overview', content: '<p>Overview panel content.</p>' },
    { id: 'details',  label: 'Details',  content: '<p>Details panel content.</p>' },
    { id: 'history',  label: 'History',  content: '<p>History panel content.</p>' },
  ]
}) %>

With icons

Preview

Home content.

Code
<%- include('modules/ui/TabGroup', {
  tabs: [
    { id: 'home',     label: 'Home',     icon: 'fa-house', content: '<p>Home content.</p>' },
    { id: 'users',    label: 'Users',    icon: 'fa-users', content: '<p>Users content.</p>' },
    { id: 'settings', label: 'Settings', icon: 'fa-gear',  content: '<p>Settings content.</p>' },
  ]
}) %>

With disabled tab

Preview

Active tab content.

Code
<%- include('modules/ui/TabGroup', {
  tabs: [
    { id: 'active',   label: 'Active',   content: '<p>Active tab content.</p>' },
    { id: 'disabled', label: 'Disabled', content: '', disabled: true },
    { id: 'another',  label: 'Another',  content: '<p>Another tab content.</p>' },
  ]
}) %>

Contributed tabs: isolate + order

Preview

Host tab: contact details.

Code
<%# A function content renders inside try/catch when isolated: a throwing tab shows a
    "failed" placeholder with Retry (or renderError) and is reported to onTabError. %>
<%- include('modules/ui/TabGroup', {
  isolate: true,
  onTabError: function (tabId, error) { report(tabId, error); },
  tabs: [
    { id: 'overview', label: 'Overview', content: overviewHtml },              // host: order 0
    { id: 'tasks', label: 'Tasks', order: 10, lazy: true, content: renderTasks },
    { id: 'calls', label: 'Calls', order: 20, lazy: true, content: renderCallLog },
  ]
}) %>
Source modules/ui/TabGroup.ejs