Docs

Main site

Installation Browser support Extend config MCP server
Validation Page speed testing Responsive design
Accordion Aspect Ratio Avatar Badge Banner Bento Grid Blockquote Breadcrumbs Button Callout Card Drawer Dropdown Link Modal Navbar Navblock Pagination Popover Progress Separator Tabs Timeline Toast Tooltip
Checkbox Datepicker File upload Form field Input Label OTP Radio Range Select Textarea Toggle
Header Footer
Accordion Auth Checkbox & Radio Content Drawers Features Modals Statistics & Metrics Teams Dropdowns
Address Contact number Currency symbol Date Emirates ID Name
Close
Home Documentation Components Tabs

Tabs

Tabs let a user switch between related views inside a single surface — service details, account sections, dashboard breakdowns — without leaving the page. "aegov-tabs" owns the active-tab state and pairs each "aegov-tab" trigger with its "aegov-tab-panel" via a matching "tab-id", implementing the full WAI-ARIA tabs keyboard pattern with a roving tabindex.

Interactive
Status
Active
Introduced
4.0.x
View source code

Anatomy

aegov-tabs is a composite of three elements: the parent container, the trigger (aegov-tab), and the content panel (aegov-tab-panel). The parent writes shared configuration — variant, size, orientation, and which tab is active — onto its children, so individual tabs and panels rarely need any prop beyond their own tab-id.

Image showing anatomy of tabs

Item Name Description
1 Tablist The row (or column) of triggers, role="tablist"
2 Tab A single trigger button, role="tab"
3 Icon (optional) Leading/trailing icon inside a tab, from the icon/icon-end slots
4 Panel The content shown for the active tab, role="tabpanel"

Basics

Place aegov-tab triggers in the tabs slot and matching aegov-tab-panel elements in the default slot, pairing each by tab-id. Use default-open to choose which tab starts active.

Overview Eligibility Documents Apply online for a residency permit. Most applications are processed within three working days. Open to UAE nationals and residents aged 18 and over with a valid Emirates ID. Upload a clear copy of your Emirates ID, recent utility bill, and proof of residence.
<aegov-tabs default-open="overview">
  <aegov-tab slot="tabs" tab-id="overview">Overview</aegov-tab>
  <aegov-tab slot="tabs" tab-id="eligibility">Eligibility</aegov-tab>
  <aegov-tab slot="tabs" tab-id="documents">Documents</aegov-tab>
  <aegov-tab-panel tab-id="overview">Apply online for a residency permit. Most applications are processed within three working days.</aegov-tab-panel>
  <aegov-tab-panel tab-id="eligibility">Open to UAE nationals and residents aged 18 and over with a valid Emirates ID.</aegov-tab-panel>
  <aegov-tab-panel tab-id="documents">Upload a clear copy of your Emirates ID, recent utility bill, and proof of residence.</aegov-tab-panel>
</aegov-tabs>

Variants

variant selects the trigger row's visual style: simple (default underline, discreet), segmented (a connected button group for view toggles), or pill (rounded individual chips).

Services Payments A list of services available to UAE residents. Outstanding fees and recent payments. Day Week Daily appointment schedule. Weekly appointment schedule. All requests Open Every service request raised on your account. Requests still in progress.
<aegov-tabs variant="simple" default-open="services">
  <aegov-tab slot="tabs" tab-id="services">Services</aegov-tab>
  <aegov-tab slot="tabs" tab-id="payments">Payments</aegov-tab>
  <aegov-tab-panel tab-id="services">A list of services available to UAE residents.</aegov-tab-panel>
  <aegov-tab-panel tab-id="payments">Outstanding fees and recent payments.</aegov-tab-panel>
</aegov-tabs>
<aegov-tabs variant="segmented" default-open="day">
  <aegov-tab slot="tabs" tab-id="day">Day</aegov-tab>
  <aegov-tab slot="tabs" tab-id="week">Week</aegov-tab>
  <aegov-tab-panel tab-id="day">Daily appointment schedule.</aegov-tab-panel>
  <aegov-tab-panel tab-id="week">Weekly appointment schedule.</aegov-tab-panel>
</aegov-tabs>
<aegov-tabs variant="pill" default-open="all">
  <aegov-tab slot="tabs" tab-id="all">All requests</aegov-tab>
  <aegov-tab slot="tabs" tab-id="open">Open</aegov-tab>
  <aegov-tab-panel tab-id="all">Every service request raised on your account.</aegov-tab-panel>
  <aegov-tab-panel tab-id="open">Requests still in progress.</aegov-tab-panel>
</aegov-tabs>

Orientation

orientation="vertical" places triggers beside the panels instead of above them, and swaps the navigation keys from left/right to up/down. A vertical tab row needs a height context from its container.

Profile Emirates ID Security Name, date of birth, and primary contact details. Emirates ID number, expiry date, and renewal status. Password, recovery email, and active sessions.
<aegov-tabs orientation="vertical" default-open="profile">
  <aegov-tab slot="tabs" tab-id="profile">Profile</aegov-tab>
  <aegov-tab slot="tabs" tab-id="emirates-id">Emirates ID</aegov-tab>
  <aegov-tab slot="tabs" tab-id="security">Security</aegov-tab>
  <aegov-tab-panel tab-id="profile">Name, date of birth, and primary contact details.</aegov-tab-panel>
  <aegov-tab-panel tab-id="emirates-id">Emirates ID number, expiry date, and renewal status.</aegov-tab-panel>
  <aegov-tab-panel tab-id="security">Password, recovery email, and active sessions.</aegov-tab-panel>
</aegov-tabs>

Sizes

size accepts three tokens — sm, base (default), lg — and scales the trigger row only; panel content is unaffected.

Small Compact triggers Compact size suits dense administrative dashboards. Use this when vertical space is tight. Large Prominent triggers Large size works well as top-level page navigation. Pair with a hero or main content area.
<aegov-tabs size="sm" default-open="a">
  <aegov-tab slot="tabs" tab-id="a">Small</aegov-tab>
  <aegov-tab slot="tabs" tab-id="b">Compact triggers</aegov-tab>
  <aegov-tab-panel tab-id="a">Compact size suits dense administrative dashboards.</aegov-tab-panel>
  <aegov-tab-panel tab-id="b">Use this when vertical space is tight.</aegov-tab-panel>
</aegov-tabs>
<aegov-tabs size="lg" default-open="a">
  <aegov-tab slot="tabs" tab-id="a">Large</aegov-tab>
  <aegov-tab slot="tabs" tab-id="b">Prominent triggers</aegov-tab>
  <aegov-tab-panel tab-id="a">Large size works well as top-level page navigation.</aegov-tab-panel>
  <aegov-tab-panel tab-id="b">Pair with a hero or main content area.</aegov-tab-panel>
</aegov-tabs>

Stretchable

Set is-stretchable="true" to distribute triggers evenly across the full container width — each grows to occupy equal space. Useful for a two- or three-way toolbar where every option carries equal weight.

Grid view List view Services arranged as cards in a grid. Services arranged as a vertical list.
<aegov-tabs variant="segmented" is-stretchable="true" default-open="grid">
  <aegov-tab slot="tabs" tab-id="grid">Grid view</aegov-tab>
  <aegov-tab slot="tabs" tab-id="list">List view</aegov-tab>
  <aegov-tab-panel tab-id="grid">Services arranged as cards in a grid.</aegov-tab-panel>
  <aegov-tab-panel tab-id="list">Services arranged as a vertical list.</aegov-tab-panel>
</aegov-tabs>

Scrollable

Set is-scrollable="true" to let the trigger row scroll when triggers exceed the container width, rather than wrapping or overflowing. A faded gradient signals scrollable content at each edge, and activating a tab smoothly scrolls it into view.

January February March April May June Statement for January. Statement for February. Statement for March. Statement for April. Statement for May. Statement for June.
<aegov-tabs is-scrollable="true" default-open="jan">
  <aegov-tab slot="tabs" tab-id="jan">January</aegov-tab>
  <aegov-tab slot="tabs" tab-id="feb">February</aegov-tab>
  <aegov-tab slot="tabs" tab-id="mar">March</aegov-tab>
  <aegov-tab slot="tabs" tab-id="apr">April</aegov-tab>
  <aegov-tab slot="tabs" tab-id="may">May</aegov-tab>
  <aegov-tab slot="tabs" tab-id="jun">June</aegov-tab>
  <aegov-tab-panel tab-id="jan">Statement for January.</aegov-tab-panel>
  <aegov-tab-panel tab-id="feb">Statement for February.</aegov-tab-panel>
  <aegov-tab-panel tab-id="mar">Statement for March.</aegov-tab-panel>
  <aegov-tab-panel tab-id="apr">Statement for April.</aegov-tab-panel>
  <aegov-tab-panel tab-id="may">Statement for May.</aegov-tab-panel>
  <aegov-tab-panel tab-id="jun">Statement for June.</aegov-tab-panel>
</aegov-tabs>

Disabled tabs

Set is-disabled="true" on an individual aegov-tab to mute it and remove it from arrow-key navigation entirely. Disabled tabs can't be activated by click or keyboard, and never emit a select event.

Active applications Archive Drafts Applications currently in review. Archive is not yet available. Saved drafts you have not submitted yet.
<aegov-tabs default-open="active">
  <aegov-tab slot="tabs" tab-id="active">Active applications</aegov-tab>
  <aegov-tab slot="tabs" tab-id="archive" is-disabled="true">Archive</aegov-tab>
  <aegov-tab slot="tabs" tab-id="drafts">Drafts</aegov-tab>
  <aegov-tab-panel tab-id="active">Applications currently in review.</aegov-tab-panel>
  <aegov-tab-panel tab-id="archive">Archive is not yet available.</aegov-tab-panel>
  <aegov-tab-panel tab-id="drafts">Saved drafts you have not submitted yet.</aegov-tab-panel>
</aegov-tabs>

Tabs with icons

aegov-tab exposes icon (before the label) and icon-end (after the label) slots for visual indicators on a trigger.

Profile Documents Personal details and contact information. Identity and supporting documents.
<aegov-tabs default-open="profile">
  <aegov-tab slot="tabs" tab-id="profile">
    <svg slot="icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>
    Profile
  </aegov-tab>
  <aegov-tab slot="tabs" tab-id="documents">
    <svg slot="icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/></svg>
    Documents
  </aegov-tab>
  <aegov-tab-panel tab-id="profile">Personal details and contact information.</aegov-tab-panel>
  <aegov-tab-panel tab-id="documents">Identity and supporting documents.</aegov-tab-panel>
</aegov-tabs>

RTL support

When the document or any ancestor is dir="rtl", the horizontal layout flows right-to-left and the arrow keys flip — ArrowLeft advances, ArrowRight retreats. Vertical orientation, Home, and End behave the same regardless of direction, and scrollable fade gradients adjust to the correct edge automatically.

اليوم الأسبوع الشهر جدول المواعيد اليومي. جدول المواعيد الأسبوعي. جدول المواعيد الشهري.
<div dir="rtl">
  <aegov-tabs variant="segmented" default-open="day">
    <aegov-tab slot="tabs" tab-id="day">اليوم</aegov-tab>
    <aegov-tab slot="tabs" tab-id="week">الأسبوع</aegov-tab>
    <aegov-tab slot="tabs" tab-id="month">الشهر</aegov-tab>
    <aegov-tab-panel tab-id="day">جدول المواعيد اليومي.</aegov-tab-panel>
    <aegov-tab-panel tab-id="week">جدول المواعيد الأسبوعي.</aegov-tab-panel>
    <aegov-tab-panel tab-id="month">جدول المواعيد الشهري.</aegov-tab-panel>
  </aegov-tabs>
</div>

Usage

Here is the recommended usage of tabs on any website or application. These are recommended usage guides, however the developer must use the best practices of web and application development to accurately use this component.

Use tabs for related views of the same object, not for sequential steps
Tabs imply the user can jump between panels in any order and come back — for a fixed, ordered sequence (like a multi-step form), a stepper or wizard pattern communicates the flow far better.

Reach for segmented or pill when the options are really a view toggle, not a content structure
The simple underline variant reads as a structural section divider; segmented/pill read as a mutually-exclusive filter or view switch — pick the one that matches what the tabs are actually doing.

Do not put more triggers in a non-scrollable tab row than comfortably fit
Triggers that wrap onto a second line or get clipped are confusing and hard to scan — either trim the list, or turn on is-scrollable so the row scrolls horizontally instead of wrapping or overflowing.

API reference

The following are the properties and references of tabs

aegov-tabs default properties

AttributeDescriptionTypeDefault

field-id

DOM id for the outer container. Auto-generated if omitted.

string

auto-generated

variant

Visual style of the trigger row: simple (underline, discreet, works well inside a card or page region), segmented (a connected button group, ideal for mutually-exclusive view toggles), or pill (rounded individual chips, reads more like filters than a structural divider).

simple | segmented | pill

simple

default-open

The tab-id of the tab active on initial render. If omitted, the first non-disabled tab is activated automatically.

string

''

size

Trigger size token. Only the trigger row scales — panel content is unaffected. Accepts a responsive breakpoint string, e.g. "sm md:base".

sm | base | lg

base

orientation

Layout of the trigger row: horizontal (triggers above the panels) or vertical (triggers beside the panels). Also swaps the arrow keys used for navigation from left/right to up/down.

horizontal | vertical

horizontal

is-scrollable

Lets the trigger row scroll (horizontally, or vertically when orientation="vertical") when triggers overflow the container, with a faded edge gradient signalling more content. Activating a tab smoothly scrolls it into view.

boolean

false

is-stretchable

Distributes triggers evenly across the full container width — each grows to occupy equal space. Useful for a two- or three-way toolbar where every option carries equal weight.

boolean

false

label-tablist

Accessible label for the underlying role="tablist" element. Defaults to a bilingual auto-detected string ("Tabs" / "علامات التبويب") — override it when the tabs control a specific, nameable region.

string

''

aegov-tab properties

AttributeDescriptionTypeDefault

tab-id

Required. Identifier matched against the corresponding aegov-tab-panel.

string

required

is-disabled

Disables this tab and its panel — muted visually, skipped entirely by arrow-key navigation, and never selectable by click. Sets aria-disabled rather than the native disabled attribute (see Accessibility).

boolean

false

active-tab-id, variant, size, orientation

Written automatically by the parent aegov-tabs — setting these directly on a child is overridden on the next sync.

(various)

(inherited)

aegov-tab-panel properties

AttributeDescriptionTypeDefault

tab-id

Required. Must match the corresponding tab's tab-id.

string

required

extra-class

Additional CSS classes merged onto the inner panel element.

string

(none)

active

Written automatically by the parent aegov-tabs — whether this panel is currently visible.

boolean

false

Slots

ComponentSlotDescription

aegov-tabs

tabs

Place aegov-tab triggers here — each must carry slot="tabs".

aegov-tabs

(default)

Place aegov-tab-panel elements here — no slot attribute needed.

aegov-tab

(default)

The tab's label text.

aegov-tab

icon

Optional icon shown before the label.

aegov-tab

icon-end

Optional icon shown after the label.

aegov-tab-panel

(default)

The panel content, shown only while its tab is active.

Events

EventComponentDetailDescription

aegovTabChange

aegov-tabs

string

Fires after the active tab changes. Detail is the new active tab-id — use it to lazily load panel content, sync URL state, or send analytics.

aegovTabSelect

aegov-tab

string

Bubbles up from a clicked tab; the parent listens to this internally. Consumers should listen for aegovTabChange on the parent instead.

Pass-through attributes

AttributeNotes

aria-*, data-* on aegov-tabs

Forwarded onto the rendered outer container.

aria-*, data-* on aegov-tab/aegov-tab-panel

Not forwarded automatically — apply directly to the element, since both render in the light DOM (no shadow root).

id

Use field-id on aegov-tabs instead — tabs and panels always get generated tab-{id}/panel-{id} ids from their tab-id for the internal aria-controls/aria-labelledby wiring.

class, style

Applied to the host element on all three components.

Notes

The following notes are applicable of this component.

Built-in accessibility

  • The trigger row uses role="tablist" with aria-orientation reflecting orientation. The default aria-label is bilingual ("Tabs" / "علامات التبويب", auto-detected from the document's direction) — override it with label-tablist when the tabs control a specific, nameable region.
  • Each trigger is a real <button> with role="tab", aria-selected, and aria-controls pointing at its panel.
  • Each panel has role="tabpanel", aria-labelledby pointing at its trigger, and the native hidden attribute while inactive — genuinely removed from the accessibility tree and from layout, not just visually hidden.
  • A real roving-tabindex pattern is implemented: only the active trigger has tabindex="0"; every other trigger has tabindex="-1", so a single Tab press moves focus straight into (and out of) the whole tablist, exactly as the WAI-ARIA tabs pattern specifies.
  • Disabled tabs set aria-disabled="true" on the trigger rather than the native disabled attribute — deliberately, so the trigger itself remains part of the same roving-tabindex/arrow-key model instead of vanishing from it — and are correctly skipped by arrow-key navigation and unclickable.
  • Activation follows focus: moving focus to a tab (by click or arrow key) also activates it and reveals its panel immediately — there's no separate "confirm" step.

Developer responsibility

The following is required for a developer to add additionally or pay attention to regarding this component.

  • Give every aegov-tab/aegov-tab-panel pair a unique, matching tab-id.
  • Give every trigger a real, meaningful accessible name in its default slot. If a trigger is icon-only, include visually-hidden text alongside the icon rather than relying on the icon alone.
  • Override label-tablist whenever the tabs control an identifiable region (e.g. "Account sections") — the bilingual default is a reasonable generic fallback, not a substitute for a specific label.
  • If a panel holds a heavy asset (a chart, a large image), consider deferring its load until aegovTabChange reports that panel's tab-id as active, rather than loading every panel's content up front.
  • aegov-tab and aegov-tab-panel must be used inside aegov-tabs — aegov-tab-panel throws if it isn't; aegov-tab logs a console error but still renders.

Keyboard support

Key Horizontal (default) Vertical
Arrow Right Moves to and activates the next tab. (no effect)
Arrow Left Moves to and activates the previous tab. (no effect)
Arrow Down (no effect) Moves to and activates the next tab.
Arrow Up (no effect) Moves to and activates the previous tab.
Home Moves to and activates the first tab. Same.
End Moves to and activates the last tab. Same.
Tab Moves focus into the tablist (landing on the active trigger) or out of it entirely — never between individual triggers. Same.

Arrow-key navigation wraps at both ends and always skips disabled tabs. In a right-to-left document, the horizontal arrows invert — Arrow Left advances and Arrow Right retreats — while vertical navigation, Home, and End stay the same in either direction.