Skip to content

CSS: tabs ​

.instui-tabs — A tabbed panel set: a tab list, selectable tabs, and their panels.

See the tabs.tab and tabs.panel members for the individual tab buttons and their content panels.

Source: panel.css

TIP

JS Enhancement — This component's CSS renders and works on its own; pair it with @pantoken/interactions to add the interactive behavior. See the modifier table below.

Usage ​

css
@import "@pantoken/components/components.css";
@import "@pantoken/components/tabs.css";

Examples ​

html
<div class="instui-tabs -variant-secondary">
  <div class="list" role="tablist" aria-label="Project views">
    <button class="tab -selected" role="tab" aria-selected="true">Overview</button>
    <button class="tab" role="tab" aria-selected="false">Activity</button>
  </div>
  <div class="panel" role="tabpanel">Project overview</div>
</div>

Structure ​

text
.instui-tabs
  list (component)
    tabs.tab (component, 0..n)
  tabs.panel (component, 0..n)
flowchart TD n0[".instui-tabs"]:::cssdoc-root n1(["list"]):::cssdoc-component n2(["tabs.tab"]):::cssdoc-component n3(["tabs.panel"]):::cssdoc-component n1 -->|0..n| n2 n0 --> n1 n0 -->|0..n| n3 click n1 "/api/css/list.md" click n2 "/api/css/tabs.tab.md" click n3 "/api/css/tabs.panel.md" classDef cssdoc-root stroke-width:1px; classDef cssdoc-part stroke-width:1px; classDef cssdoc-slot stroke-width:1px; classDef cssdoc-component stroke-width:1px;

Modifiers ​

ModifierDescription
.-overflow-scrollKeep the tab list on one line and let it scroll horizontally instead of wrapping, hiding the scrollbar.
.-variant-secondaryRounded "folder" tabs with a selected tab that visually connects into the panel below. @affects tabs.tab — Restyles the tab buttons into the rounded "folder" look.

Parts ​

PartDescription
.listThe row of tabs.

Accessibility ​

Wire the tab list with role="tablist", each tab with role="tab" and aria-selected, and each panel with role="tabpanel".

ConditionsRebrand (light)Rebrand (dark)CanvasCanvas High Contrast
forced-colors-focus-visibleWCAG 2.2 1.4.11, 2.4.7PassPassPassPass
more-contrast-respectedWCAG 2.2 1.4.3, 1.4.6Review neededReview neededReview neededReview needed

All six measured pieces of text pass with more contrast. two other pieces can't be reduced to one color. "Billing" can't be measured because an element behind it is partly transparent.

reduced-motion-respectedWCAG 2.2 2.3.3, 2.2.2PassPassPassPass
reflow-at-320pxWCAG 2.2 1.4.10PassPassPassPass
text-spacing-no-clippingWCAG 2.2 1.4.12PassPassPassPass
InteractionsRebrand (light)Rebrand (dark)CanvasCanvas High Contrast
arrow-keys-move-between-tabsWCAG 2.2 2.1.1PassPassPassPass
focus-indicator-visibleWCAG 2.2 2.4.7PassPassPassPass
home-and-end-workWCAG 2.2 2.1.1FailFailFailFail

End didn't move to the last tab.

no-focus-trapWCAG 2.2 2.1.2PassPassPassPass
selected-state-exposedWCAG 2.2 4.1.2FailFailFailFail

3 tabs are aria-selected="true". A tab list should have exactly one.

trigger-reachable-by-tabWCAG 2.2 2.1.1PassPassPassPass
Computed stylesRebrand (light)Rebrand (dark)CanvasCanvas High Contrast
boundary-contrastWCAG 2.2 1.4.11PassPassPassPass
focus-indicator-contrastWCAG 2.2 1.4.11, 2.4.13PassPassPassPass
text-contrast-by-stateWCAG 2.2 1.4.3PassPassPassPass
Screen reader (simulated)Rebrand (light)Rebrand (dark)CanvasCanvas High Contrast
AnnouncementsPassPassPassPass

These automated results do not establish that the page meets WCAG; manual review is still needed.

Tokens consumed ​

TokenTypeValue
--instui-component-tabs-default-background<color>#00000000

Subcomponents ​