svogg-components 0.5.4

Tabs

typescript
import { Tablist, Tab, TabPanel } from 'svogg-components';

Collection of tab components meant to be used in conjunction with each other.


Handles tab selection internally and encourages accessible implementations by requiring the use of HTML id attributes on tabs, which simultaneously works well with attribute such as aria-controls and aria-labelledby.

🕷

TabList

Props
NameTypeRequiredDefaultDescription
selectedTab string true HTML `id` attribute of selected tab

Tab

Props
NameTypeRequiredDefaultDescription
selected boolean false false Tab selected state
controls (string | undefined) false - HTML `aria-controls` attribute
id string true HTML `id` attribute
Events
NameDetailTypeDescription
keydown undefined forwarded

TabPanel

Props
NameTypeRequiredDefaultDescription
labelledby string true HTML `aria-labelledby` attribute
active boolean false false Panel active state
id (string | undefined) false - HTML `id` attribute

CSS

ClassDescription
.svogg-tablist Applied to tablist
.svogg-tab Applied to tabs
.selected Applied to selected tab

Keyboard navigation

  1. Tab
    1. When focus moves into the component, places focus on the active tab.
    2. If a tab has focus, moves focus to the next element in the document tab sequence. If panels are used, this would be the active tab panel.
    3. If a tab panel has focus, moves focus to the first focusable element within the panel, or moves focus to the next element in the document tab sequence.
  2. Shift + Tab
    1. When focus moves into the component, places focus on the active tab panel if panels are used, else moves focus to the active tab.
    2. If the active tab panel has focus, moves focus to the active tab.
    3. If a tab has focus, moves focus to the previous element in the document tab sequence.
  3. or
    1. If a tab has focus, selects and moves focus to the next/previous tab.