Tabs
Switches between related views within the same context. It exposes the selected value—each tab declares its own (data-ts-value), and the matching panel is shown. It has variants and a vertical orientation (orientation-vertical).
Navigation · TaishoDS Core, in plain HTML.
Examples
One working example per case. Each example is the HTML of its preview—copy it as is, and with Core’s CSS and JS loaded, it looks and works the same.
Tabs with three panels
Class reference
Every value of each modifier, with its HTML ready to copy.
Variant
Tab style: default (underline) or secondary (pills).
Orientation
horizontal (row) or vertical (side column).
States
is-active marks the open tab; disabled disables it.
Combinations
Variant and orientation combined.
When to use
- They’re alternate views of the same object, like details, activity, and settings.
- Only one makes sense at a time, and switching is cheap.
- Users don’t need to compare two views at the same time.
When not to use
- It’s a form value, not a view →
segmented-control. - They’re separate pages with their own URL →
nav-barorsidebar. - The content is best read in full, top to bottom →
accordionor plain sections.
Do
- Short labels that say what’s inside.
- Few tabs. If they don’t fit on one line, this isn’t the right component.
Don’t
- Don’t hide something the user always needs to see in a tab.
- Don’t use them for the steps of a process. Steps have an order; tabs don’t.
Related
TaishoDS Core
Needs Core’s JS, which hooks in through data-ts-* attributes.
Core switches the active panel. The markup already includes role="tab".
Core hooks into it through these attributes. They go in the markup, and there’s nothing to initialize.
data-ts-tabsdata-ts-tabs-paneldata-ts-tabs-tabdata-ts-value
What it does: Switches the active panel and keeps aria-selected and tabindex in sync. The ← and → arrow keys move between tabs (APG pattern).
From the CDN, without a build, load taisho.tabs.css along with taisho.base.css. Also load:
taisho.badge.css
For how Core works in general, see Behavior.
Accessibility
Implements the Tabs pattern from the WAI-ARIA APG.
role="tablist"/role="tab"/role="tabpanel"pattern witharia-selectedandaria-orientation.- Each tab carries an
idandaria-controlspointing to its panel. Each panel carriesaria-labelledbypointing to its tab, so a screen reader announces it with the tab’s name. Pairing comes fromdata-ts-value. - Core generates any missing
idon init and keeps the ones already written, along witharia-controls,aria-labelledby, andtabindex. A tab without a panel gets noaria-controls, so it never points at nothing. - The panel is a Tab stop (
tabindex="0"), so content without focusable elements is still reachable by keyboard. Inactive panels carryhidden. - Roving tabindex: the active tab is the only one in the Tab order. The arrow keys of the tablist’s axis switch tabs and selection follows focus.
disabledtabs are skipped. - When the tab changes, the indicator slides to the new one with a
transformtransition. Underprefers-reduced-motion: reduceit jumps without animating.
Keyboard
On top of what the browser already does (Tab moves focus, Enter activates a button).
| Key | What it does |
|---|---|
| →← | In a horizontal tablist (orientation-horizontal) they switch to the next and previous tab, wrapping around. On an RTL page they swap: ← moves forward and → moves back. In the vertical tablist they do nothing. |
| ↓↑ | In a vertical tablist (orientation-vertical, which exposes aria-orientation="vertical") they switch to the next and previous tab. In the horizontal one they do nothing and the page keeps scrolling. |
| Home/End | First and last enabled tab. |
| Tab | Leaves the tablist. The active tab is the only tab stop, and the next one is the panel (tabindex="0"). |
Verification
What was actually tested. Anything that wasn’t tested says so—we’d rather say “not verified” than claim too much.
- axe WCAG 2.2 A + AA in a real browser, in light and dark mode, before every release.
- keyboard Key map documented above, checked against the component.
- screen reader Not verified with a screen reader. Test it in your own combination of components, not just here, where each one appears alone and on its happy path.