All components

Tabs

Switch between related views.

Examples

Switch between related views

Two items need review.
React code
import { Tabs, TabList, Tab, TabPanel } from "@accelerate/react/components";

export function Example() {
  return (
    <>
      <Tabs>
        <TabList aria-label="Work item views">
          <Tab id="summary-tab" aria-controls="summary-panel" aria-selected="true">Summary</Tab>
          <Tab id="notes-tab" aria-controls="notes-panel" aria-selected="false">Notes</Tab>
        </TabList>
        <TabPanel id="summary-panel" aria-labelledby="summary-tab" tabIndex={0}>Two items need review.</TabPanel>
        <TabPanel id="notes-panel" aria-labelledby="notes-tab" tabIndex={0} hidden>No notes yet.</TabPanel>
      </Tabs>
    </>
  );
}
Angular code
import { Component } from "@angular/core";
import {
  AccTabs,
  AccTabList,
  AccTab,
  AccTabPanel,
} from "@accelerate/angular/components";

@Component({
  selector: "app-example",
  imports: [
    AccTabs,
    AccTabList,
    AccTab,
    AccTabPanel,
  ],
  template: `
    <div accTabs>
      <div accTabList aria-label="Work item views">
        <button accTab id="summary-tab" aria-controls="summary-panel" aria-selected="true">Summary</button>
        <button accTab id="notes-tab" aria-controls="notes-panel" aria-selected="false">Notes</button>
      </div>
      <div accTabPanel id="summary-panel" aria-labelledby="summary-tab" tabindex="0">Two items need review.</div>
      <div accTabPanel id="notes-panel" aria-labelledby="notes-tab" tabindex="0" hidden>No notes yet.</div>
    </div>
  `,
})
export class Example {}

Vertical navigation

Your profile
React code
import { Tabs, TabList, Tab, TabPanel } from "@accelerate/react/components";

export function Example() {
  return (
    <>
      <Tabs>
        <TabList aria-label="Settings" aria-orientation="vertical">
          <Tab id="profile-tab" aria-controls="profile-panel" aria-selected="true">Profile</Tab>
          <Tab id="access-tab" aria-controls="access-panel" aria-selected="false">Access</Tab>
        </TabList>
        <TabPanel id="profile-panel" aria-labelledby="profile-tab" tabIndex={0}>Your profile</TabPanel>
        <TabPanel id="access-panel" aria-labelledby="access-tab" tabIndex={0} hidden>Your access</TabPanel>
      </Tabs>
    </>
  );
}
Angular code
import { Component } from "@angular/core";
import {
  AccTabs,
  AccTabList,
  AccTab,
  AccTabPanel,
} from "@accelerate/angular/components";

@Component({
  selector: "app-example",
  imports: [
    AccTabs,
    AccTabList,
    AccTab,
    AccTabPanel,
  ],
  template: `
    <div accTabs>
      <div accTabList aria-label="Settings" aria-orientation="vertical">
        <button accTab id="profile-tab" aria-controls="profile-panel" aria-selected="true">Profile</button>
        <button accTab id="access-tab" aria-controls="access-panel" aria-selected="false">Access</button>
      </div>
      <div accTabPanel id="profile-panel" aria-labelledby="profile-tab" tabindex="0">Your profile</div>
      <div accTabPanel id="access-panel" aria-labelledby="access-tab" tabindex="0" hidden>Your access</div>
    </div>
  `,
})
export class Example {}

Installation

Source preview. The expanded component catalog is ahead of the public npm releases. To run these examples in your own application, use packages built from the SDK source used for the previews or a release that includes the APIs below.

React
@accelerate/ui@0.4.0 and @accelerate/react@0.4.0
Angular
@accelerate/ui@0.4.0 and @accelerate/angular@0.2.0

Load @accelerate/ui/theme.css and put acc-theme on the app or the region using Accelerator components. See the framework setup guide for the theme and adapter conventions.

Usage

Compose TabList, Tab, and TabPanel. Link tabs to panels with IDs, aria-controls and aria-labelledby. Arrow keys follow list orientation and page direction.

Import the React component Tabs from @accelerate/react/components. For Angular, add AccTabs to the standalone component’s imports and use <div accTabs>.

Examples use these React parts: Tabs, TabList, Tab, TabPanel. The Angular examples show the corresponding directives and template hosts.

API reference

aria-controls / aria-labelledby
Connect every tab and panel with page-unique IDs.
aria-selected
Marks the initial active tab.
aria-orientation
Set vertical on TabList for up and down arrow navigation.