Skip to main content
PROYECTOVIVIANA

Tabs

Tabs organize content into separate views where only one view is visible at a time. Users can switch between views by selecting the corresponding tab.

Import

import { Tabs, TabList, Tab, TabPanel } from '@proyecto-viviana/solid-spectrum';

Basic Usage

A simple tab interface with multiple panels.

Manage your account settings, profile information, and preferences.
<Tabs items={tabs} aria-label="Settings">
  <TabList>
    {(item) => <Tab id={item.id}>{item.label}</Tab>}
  </TabList>
  <TabPanel id="account">...</TabPanel>
  <TabPanel id="password">...</TabPanel>
  <TabPanel id="notifications">...</TabPanel>
</Tabs>

Controlled Tabs

Control which tab is selected programmatically.

<Tabs items={tabs} selectedKey={selectedKey()} onSelectionChange={setSelectedKey} aria-label="Controlled tabs">...</Tabs>

Disabled Tabs

Individual tabs can be disabled.

Free tier features available to all users.
<Tabs items={tabs} disabledKeys={["enterprise"]} aria-label="Feature tiers">...</Tabs>

Vertical Orientation

Tabs can be displayed vertically.

General settings and preferences.
<Tabs items={tabs} orientation="vertical" aria-label="Vertical navigation">...</Tabs>

Tabs Props

Props

PropTypeDefaultDescription
itemsT[]Collection of tab items
selectedKeystringCurrently selected tab key (controlled)
defaultSelectedKeystringDefault selected tab (uncontrolled)
onSelectionChange(key: string) => voidHandler called when selection changes
orientation'horizontal' | 'vertical''horizontal'Tab layout orientation
isDisabledbooleanfalseWhether all tabs are disabled
disabledKeysIterable<string>Keys of disabled tabs

Tab Props

Props

PropTypeDefaultDescription
idstringUnique identifier for the tab
isDisabledbooleanfalseWhether the tab is disabled
childrenJSX.ElementTab label content

TabPanel Props

Props

PropTypeDefaultDescription
idstringMust match the corresponding Tab id
childrenJSX.ElementPanel content

Accessibility

  • Uses tablist, tab, and tabpanel ARIA roles
  • Arrow keys navigate between tabs
  • Home/End keys jump to first/last tab
  • Tab panels are linked via aria-controls and aria-labelledby
  • Focus indicator clearly shows which tab is focused
  • Automatic activation on focus (follows ARIA best practices)