Tabs
A row of tab buttons that shows one of several panels at a time.
<arc-tabs>Overview
Tabs puts related panels in one space and shows one at a time. Each <arc-tab> child sets the label for its button and holds its panel's content. Use it when the reader switches between panels and doesn't need to see two at once.
The component follows the WAI-ARIA Tabs pattern. Each button has role="tab" inside a role="tablist", and the panel has role="tabpanel", linked by aria-controls and aria-labelledby. Focus uses a roving tabindex, so the arrow keys move between tabs and Tab leaves the tab list.
Switching tabs moves one indicator between them: the underline in the default variant, the ground behind the selection in pills and in vertical bars. The incoming panel rises into place. Both animations are CSS and stop under prefers-reduced-motion. When there are more tabs than the bar can show, it scrolls the selected tab into view without scrolling the page. Inactive panels are hidden with display: none, so they're also out of the accessibility tree.
Guidelines
Do
- Keep tab labels to one or two words so the whole bar fits without scrolling
- Disable a tab that's temporarily unavailable instead of hiding it
Don't
- Don't use Tabs for sequential steps. Use StepperNav
- Don't nest Tabs inside Tabs. Two tab bars are hard to follow with a keyboard or screen reader
- Don't put a Save button or other key action in a tab that isn't open by default
- Don't put more than five or six tabs in one group. Use a dropdown or sidebar navigation for more
Features
- With `orientation="vertical"`, the up and down arrows replace left and right
- A disabled tab stays visible, but the arrow keys skip it and clicking does nothing
- `selected` sets the active tab by zero-based index
Preview
Usage
Its events and state need JavaScript, so use the Web Component or a framework wrapper for those.
<arc-tabs>
<arc-tab label="Overview">
ARC UI is a framework-agnostic component library built on web standards.
</arc-tab>
<arc-tab label="Features">
Keyboard navigation, ARIA roles, smooth transitions, and lazy rendering.
</arc-tab>
<arc-tab label="Changelog">
v2.4.0 — Disabled tab support and improved focus-visible ring styling.
</arc-tab>
</arc-tabs>import { Tabs, Tab } from '@arclux/arc-ui-react';
export default function Example() {
return (
<Tabs>
<Tab label="Overview">
ARC UI is a framework-agnostic component library built on web standards.
</Tab>
<Tab label="Features">
Keyboard navigation, ARIA roles, smooth transitions, and lazy rendering.
</Tab>
<Tab label="Changelog">
v2.4.0 — Disabled tab support and improved focus-visible ring styling.
</Tab>
</Tabs>
);
}<script setup>
import { Tabs, Tab } from '@arclux/arc-ui-vue';
</script>
<template>
<Tabs>
<Tab label="Overview">
ARC UI is a framework-agnostic component library built on web standards.
</Tab>
<Tab label="Features">
Keyboard navigation, ARIA roles, smooth transitions, and lazy rendering.
</Tab>
<Tab label="Changelog">
v2.4.0 — Disabled tab support and improved focus-visible ring styling.
</Tab>
</Tabs>
</template><script>
import { Tabs, Tab } from '@arclux/arc-ui-svelte';
</script>
<Tabs>
<Tab label="Overview">
ARC UI is a framework-agnostic component library built on web standards.
</Tab>
<Tab label="Features">
Keyboard navigation, ARIA roles, smooth transitions, and lazy rendering.
</Tab>
<Tab label="Changelog">
v2.4.0 — Disabled tab support and improved focus-visible ring styling.
</Tab>
</Tabs>import { Component } from '@angular/core';
import { Tabs, Tab } from '@arclux/arc-ui-angular';
@Component({
imports: [Tabs, Tab],
template: `
<arc-tabs>
<arc-tab label="Overview">
ARC UI is a framework-agnostic component library built on web standards.
</arc-tab>
<arc-tab label="Features">
Keyboard navigation, ARIA roles, smooth transitions, and lazy rendering.
</arc-tab>
<arc-tab label="Changelog">
v2.4.0 — Disabled tab support and improved focus-visible ring styling.
</arc-tab>
</arc-tabs>
`,
})
export class TabsDemoComponent {}import { Tabs, Tab } from '@arclux/arc-ui-solid';
export default function TabsDemo() {
return (
<Tabs>
<Tab label="Overview">
ARC UI is a framework-agnostic component library built on web standards.
</Tab>
<Tab label="Features">
Keyboard navigation, ARIA roles, smooth transitions, and lazy rendering.
</Tab>
<Tab label="Changelog">
v2.4.0 — Disabled tab support and improved focus-visible ring styling.
</Tab>
</Tabs>
);
}import { Tabs, Tab } from '@arclux/arc-ui-preact';
export default function TabsDemo() {
return (
<Tabs>
<Tab label="Overview">
ARC UI is a framework-agnostic component library built on web standards.
</Tab>
<Tab label="Features">
Keyboard navigation, ARIA roles, smooth transitions, and lazy rendering.
</Tab>
<Tab label="Changelog">
v2.4.0 — Disabled tab support and improved focus-visible ring styling.
</Tab>
</Tabs>
);
}<arc-tabs>
<arc-tab label="Overview">
ARC UI is a framework-agnostic component library built on web standards.
</arc-tab>
<arc-tab label="Features">
Keyboard navigation, ARIA roles, smooth transitions, and lazy rendering.
</arc-tab>
<arc-tab label="Changelog">
v2.4.0 — Disabled tab support and improved focus-visible ring styling.
</arc-tab>
</arc-tabs>API
selectednumber0- Zero-based index of the currently active tab. Changing this value programmatically switches the visible panel and updates ARIA attributes. Out-of-range values are clamped to the nearest valid index.
align'start' | 'center' | 'end''start'- Aligns the tab list. Options: 'start', 'center', 'end'.
variant'underline' | 'pills''underline'- Visual style of the tabs. Options: 'underline', 'pills'.
orientation'horizontal' | 'vertical''horizontal'- Layout direction of the tab list. Use 'vertical' to place tabs in a sidebar column with the panel to the right. Arrow-key navigation automatically switches to up/down in vertical mode.
Events
arc-change- Fired when the active tab changes
Tab
<arc-tab>One tab in a Tabs group. Its `label` is the button text, its content is the panel, and `disabled` turns the button off.
labelstring''- Text displayed on the tab button. Keep labels concise (one or two words) to prevent the tab bar from overflowing.
disabledbooleanfalse- When true, the tab button is dimmed, is skipped by the arrow keys and cannot be selected by click. A disabled tab that is already selected stays visible; disabling is not a way to hide a panel.