Tabs
Switches between sibling panels of content with a row of tabs, such as the sections of a settings page. Arrow keys move between tabs.
Intents
tabs
navigation
layout
Examples
Each one rendered live, over the markup that produces it.
Two panels
<aihio-tabs value="one">
<aihio-tab-list>
<aihio-tab value="one">Tab 1</aihio-tab>
<aihio-tab value="two">Tab 2</aihio-tab>
</aihio-tab-list>
<aihio-tab-panel value="one">Content 1</aihio-tab-panel>
<aihio-tab-panel value="two">Content 2</aihio-tab-panel>
</aihio-tabs>
Mistakes
Each one beside its fix, with what aihio lint says about it. The prompt fragment gives agents the
same pairs, and the build fails if the linter stops catching one or a fix stops passing.
aihio-tab must sit inside an aihio-tab-list; keyboard navigation is bound to the list.
Don't
<aihio-tabs>
<aihio-tab value="a">A</aihio-tab>
<aihio-tab-panel value="a">Content</aihio-tab-panel>
</aihio-tabs>
aihio lint reports
-
missing-required-childerror -
invalid-childerror
Do
<aihio-tabs value="a">
<aihio-tab-list>
<aihio-tab value="a">A</aihio-tab>
</aihio-tab-list>
<aihio-tab-panel value="a">Content</aihio-tab-panel>
</aihio-tabs>
Panel value does not match any tab value; the panel will never activate.
Don't
<aihio-tabs value="a">
<aihio-tab-list>
<aihio-tab value="a">A</aihio-tab>
</aihio-tab-list>
<aihio-tab-panel value="b">Content</aihio-tab-panel>
</aihio-tabs>
aihio lint reports
-
tabs-value-pairserror
Do
<aihio-tabs value="a">
<aihio-tab-list>
<aihio-tab value="a">A</aihio-tab>
</aihio-tab-list>
<aihio-tab-panel value="a">Content</aihio-tab-panel>
</aihio-tabs>
API
Every attribute, property, method, and event the schema declares for aihio-tabs.
Attributes
value- string
- The currently active tab value
Composition
- Required children
-
aihio-tab-listaihio-tab-panel - Allowed children
-
aihio-tab-listaihio-tab-panel
Sub-components
Used only inside aihio-tabs, which gives them their roles and keyboard behaviour.
<aihio-tab-list>
Container for tab triggers
<aihio-tab>
Individual tab trigger
Attributes
value- string
- Stable value that matches a corresponding
aihio-tab-panel. disabled-
boolean
default
false - Disables the tab and removes it from keyboard navigation.
Events
aihio-tab-select-
detail
{ value: string } - Fired when the tab is activated;
aihio-tabslistens for this to drive selection
<aihio-tab-panel>
Content panel for a tab
Attributes
value- string
- Stable value that matches a corresponding
aihio-tab.
Accessibility
What you have to provide, and what the component already does. The obligations with a rule are checked by
aihio lint and by the dev build's console warnings.
Your obligations
-
error When everyaihio-tabandaihio-tab-panelMatch each tab's value to exactly one panel's value. Mismatched values leave panels orphaned.
Checked as
tabs-value-pairs
Handled for you
role="tablist"onaihio-tab-listrole="tab"onaihio-tabwith aria-selected and tabindex rovingrole="tabpanel"onaihio-tab-panelwith aria-labelledby wired to its tab- Arrow keys, Home, End move between tabs
- Panels are hidden when inactive
In patterns
Canonical compositions that use aihio-tabs.