Skip to content
Slotted

Tabs

A row of tabs over a set of panels, for switching between views of one record or one screen without leaving it.

Customer
Harbor & Pine
Placed
September 8, 2026
Payment terms
Net 30
Total
$1,240.00

Installation

The packages are a 0.x beta on npm, and their public API changes between beta releases without deprecation. One line installs the binding and the default theme.

bash
pnpm add @slotted/react @slotted/theme @slotted/themes
tsx
import { Tab, TabActions, TabList, TabPanel, Tabs, TabsDefaultsProvider } from '@slotted/react';

Variants

line is the default: labels over a hairline, with the marker under the selected tab. contained draws a sunken track with a surface for the selected tab, for a set of views inside a card or a toolbar. track="none" keeps the labels and the marker and drops the hairline, for a list placed on a line the page already draws, such as the edge of a card header.

14 purchase orders due this week.
14 purchase orders due this week.
14 purchase orders due this week.

Sizes

size sets the list to one step of the control scale: sm for dense panels and table toolbars, md for most screens, lg for a page’s top-level views. The height, type, padding and icon size follow the step.

1,284 units on hand across 3 warehouses.
1,284 units on hand across 3 warehouses.
1,284 units on hand across 3 warehouses.

Equal widths

fit="equal" divides the line into equal shares, one per tab, for two to four short labels that should line up with the content below. A label longer than its share is cut with an ellipsis and keeps its full text as the tab’s name. With the default fit="auto", each tab is as wide as its label and the list scrolls instead.

14 purchase orders due this week.

Vertical

orientation="vertical" stacks the tabs in a column beside the panels, for settings sections and long lists of views. Up and Down arrows move between tabs, and the list carries aria-orientation="vertical". A vertical list never scrolls sideways: the page scrolls.

Code: RNOAddress: 1450 Terminal Way, Reno, NV 89502Time zone: Pacific Time

Icons and counts

start puts an icon before the label and end puts a count or a status after it; in Angular, mark those elements with slTabStart and slTabEnd. Both stand beside the label inside the tab, so the tab’s gap spaces them and only the words are cut under fit="equal". A Badge with count hides itself at zero unless it has showZero.

12 open orders, $14,380.00 in total.

Disabled tabs

disabled on a tab removes it from the arrow-key sequence and from pointer selection while the rest of the list works. disabled on Tabs disables every tab. A disabled tab cannot receive focus, so state the reason on the screen, here in the open panel.

Awaiting pickup. The invoice is issued once the order ships.
Locked while the warehouse recounts this order.

Activation

With activation="automatic", the default, each arrow key press selects the tab it lands on. With activation="manual", the arrow keys move focus only, and Enter or Space selects. Use manual activation when showing a panel costs a request or a heavy render, so moving across the list does not trigger one per tab.

Automatic: the arrow keys select as they move.
Revenue this quarter: $412,800.00.
Manual: the arrow keys move focus; Enter or Space selects.
Revenue this quarter: $412,800.00.

Controlled

Pass value and update it from onValueChange when something outside the tabs changes the view, such as a link in a notice; in Angular, bind [value] and read the new value from (valueChange). The handler receives the request before the selection moves; request.cancel() keeps the current tab.

2 invoices are past due.
12 open orders, $14,380.00 in total.

Keyboard

Tab moves focus to the selected tab, and a second Tab moves it to the panel. Left and Right move between tabs and wrap at the ends; Home and End reach the first and last enabled tab. Each change reports its reason: pointer for a click, keyboard for the arrows, Home, End, Enter and Space, remove when a closed tab hands the selection to its neighbour.

18 lines to pick in zone C.
Nothing selected yet.

Mounting panels

mount decides when a panel’s content exists. active, the default, builds the content when its tab is selected and removes it when another tab is selected, so the state inside it is lost. lazy builds it on first selection and keeps it. eager builds every panel up front. The panel element itself is always present and hidden, so every tab’s aria-controls names an element. In Angular, write the content inside <ng-template slTabPanelContent> so the components in it are created only when mount says so; projected content is created with the page. Type a note in each example below, switch to Summary, and switch back.

mount="active": the note is built again, empty, on return.
mount="lazy": the note keeps what was typed.

Closable tabs

dismissible adds a close button to a tab and binds Delete to the focused tab; dismissLabel names the button, such as “Close SO-1187”. onTabDismiss in React and (tabDismiss) in Angular ask the page to remove the tab: the component removes nothing itself, because the list of open tabs is the page’s data. When the closed tab was selected, the selection moves to the next tab, or to the previous one when it was last, with the reason remove.

Brightline Studio, $318.50.

Actions beside the list

TabActions in React and slTabActions in Angular hold controls on the same row as the tabs, at its end. Put a Toolbar in it: the toolbar is one stop in the Tab sequence however many buttons it holds, so the panel stays two Tab presses from the list.

6 lines from Quill & Co., $4,812.00.

href renders the tab as a link. A plain click selects the tab and the page does not navigate; a click with Ctrl, Cmd, Shift or Alt is left to the browser, which opens the address in a new browser tab or window. With a router, give each tab the route of its view and navigate from onValueChange.

Tabs over one region

A list without panels can filter a single region, such as a table. Set controls on each tab to the region’s id, so aria-controls names it, and change what the region shows from the selected value. The counts in this example come from the same rows the table shows.

OrderCustomerStatusTotal
SO-1187Harbor & PineOpen$1,240.00
SO-1188Brightline StudioShipped$318.50
SO-1190Northgate LabsOpen$2,906.10
SO-1191Verde KitchenDelayed$86.00
SO-1193Quill & Co.Shipped$540.25

Many tabs and narrow columns

A list wider than its container scrolls instead of wrapping or cutting labels. Paging buttons appear at the ends while there is more to scroll, and the selected tab is scrolled into view, here Memphis, TN. The paging buttons are outside the Tab sequence: the arrow keys reach every tab and scroll each one into view.

MEM: 46 open orders to ship today.

Defaults for a section

TabsDefaultsProvider in React and provideTabsDefaults in Angular set activation, orientation, size, variant, track, fit, mount and loop once for every tabs component under them. A value set on one Tabs still wins, as variant="line" does on the second list.

1,284 units on hand.
3 purchase orders for OAK-90 are open.

Record page header

A record page puts its identity and actions above the tabs and the record’s sections in the panels. Icons and counts make each section recognizable at a glance; the counts come from the same data the panels show.

Order SO-1187

Awaiting pickup
Harbor & Pine · Placed September 8, 2026
Customer
Harbor & Pine
Placed
September 8, 2026
Payment terms
Net 30
Ship to
88 Dock Street, Portland, OR
Carrier
Atlas Freight
Total
$1,240.00

Settings page

Vertical tabs list the sections of a settings page beside the open section. Each panel starts with its own heading, so the section stays named while the reader works in it.

Workspace

Printed on every invoice and packing slip.

Accessibility

KeyEffectFocus
Tabmoves focus into the listthe selected tab, which is the only tab in the tab sequence
ArrowRightmoves to the next tab in a horizontal list and wraps at the end; activates it when activation is automaticthe tab moved to
ArrowLeftmoves to the previous tab in a horizontal list and wraps at the start; activates it when activation is automaticthe tab moved to
ArrowDownthe same as ArrowRight in a vertical list, and nothing in a horizontal one so the page keeps scrollingthe tab moved to, in a vertical list
ArrowUpthe same as ArrowLeft in a vertical list, and nothing in a horizontal one so the page keeps scrollingthe tab moved to, in a vertical list
Homemoves to the first tab that is not disabled; activates it when activation is automaticthe first enabled tab
Endmoves to the last tab that is not disabled; activates it when activation is automaticthe last enabled tab
Enteractivates the focused tabstays on the tab
Spaceactivates the focused tabstays on the tab
Deletedismisses the focused tab when it is dismissiblethe following tab, the preceding one when the dismissed tab was last, or the list itself when none is left
  • Selecting a tab never waits for its panel: keep value urgent and render the region from useDeferredValue(value), which deferPanels does for the panels and useTabs().shownValue hands a region outside them. Wrapping the setter in startTransition delays the marker too.
  • Tabs implements the WAI-ARIA APG Tabs pattern (w3.org/WAI/ARIA/apg/patterns/tabs/) and its whole keyboard table: Tab enters the list on the selected tab and leaves to the panel, the arrow keys of the list’s direction move focus and wrap at both ends, Home and End reach the first and last enabled tab, Enter and Space select under manual activation, and Delete closes a dismissible tab. A horizontal list does not listen for Up and Down, so those keys keep scrolling the page while focus is in the list.
  • After a dismissal, focus follows the pattern: the next tab, the previous one when the closed tab was last, or the list itself when no tab is left, which is why the list carries tabindex="-1". The selection follows the same rule, with the reason remove.
  • The close button is outside the arrow-key sequence and inside the accessibility tree. A screen reader reaches and presses it; from the keyboard, Delete closes the focused tab, and the tab announces the key with aria-keyshortcuts. In the arrow-key sequence, close buttons would double the presses it takes to cross the list.
  • The paging controls are aria-hidden and outside the Tab sequence, because the arrow keys reach every tab and scroll it into view. Cloudscape’s guidance warns against extra Tab stops between a tab list and its panel.
  • A list that starts to overflow scrolls the selected tab into view once its paging controls are drawn, so the selected tab is not left behind the end control.
  • Each tab names its panel with aria-controls and each panel names its tab with aria-labelledby. The ids come from the value, with the characters an id cannot hold escaped rather than replaced, so two values that differ only by a space never share a panel.
  • The selected tab is never shown by color alone: the marker is a bar never thinner than a thick border, which stays visible in the high-contrast scheme, where the theme paints every surface Canvas and the fill of the contained variant disappears.
  • A panel carries tabindex="0", so the Tab key reaches it from the list. The pattern permits that stop even when the panel’s first content is focusable.

API

Tabs

Props

valuestring
The value of the selected tab. Passing it makes the selection controlled for the life of the component; without it, Tabs keeps the selection and starts from defaultValue.
defaultValuestring
The value an uncontrolled Tabs starts from, read once. When it is unset, no tab is selected and no panel is shown.
activation'automatic' | 'manual'Default automatic
On Tabs, TabsDefaultsProviderWhether moving focus to a tab also selects it. The APG recommends automatic when panels show without a noticeable delay, and manual when a panel has to be fetched.
orientation'horizontal' | 'vertical'Default horizontal
On Tabs, TabsDefaultsProviderWhich way the list runs, and so which arrow keys move between tabs. A horizontal list ignores Up and Down, so those keys keep scrolling the page.
size'sm' | 'md' | 'lg'Default md
On Tabs, TabsDefaultsProviderThe control step of the list: height, type, padding and inner gap, all from the control scales the theme restates per density.
variant'line' | 'contained'Default line
On Tabs, TabsDefaultsProviderHow the list is drawn. Both variants paint the accent marker, which keeps the selected tab visible in the high-contrast scheme, where every surface is flattened.
track'line' | 'none'Default line
On Tabs, TabsDefaultsProviderWhether the list draws the line its tabs stand on. none is for a list placed on a line the page already draws, such as a card header’s edge or a table’s rule, where two hairlines a pixel apart read as one smudge. The marker then sits on the item’s own edge, on the line that is there.
fit'auto' | 'equal'Default auto
On Tabs, TabsDefaultsProviderWhether each tab is as wide as its label or takes an equal share of the line. equal cuts a label longer than its share with an ellipsis; auto never cuts a label and scrolls the list instead.
mount'active' | 'lazy' | 'eager'Default active
On Tabs, TabsDefaultsProviderWhen a panel’s content exists: only while its tab is selected (active), from its first selection on (lazy), or from the start (eager). A panel that is not selected carries the hidden attribute.
deferPanelsbooleanDefault true under mount="active", false otherwise
Whether the panels render from useDeferredValue(value). The selected tab paints in the click’s frame and its panel renders after it; until it is ready the panel on screen stays, with aria-busy and data-pending. A panel that suspends keeps the shown one when its Suspense boundary is outside Tabs; a boundary inside the new panel shows its own fallback.
loopbooleanDefault true
On Tabs, TabsDefaultsProviderWhether the arrow keys wrap past the ends of the list.
disabledbooleanDefault false
Disables every tab with the native attribute, which also makes the arrow keys skip them, and dims the track.
value, on Tabstring
On TabWhat this tab selects, and what the value of Tabs holds. It reaches the DOM as data-value, which the keyboard reads.
disabled, on TabbooleanDefault from Tabs, or false
On TabDisables this tab only, so one tab can be unavailable in a working list. Unset rather than false, so the tab follows Tabs.
dismissiblebooleanDefault false
On TabDraws the close button and binds Delete on the tab, announced through aria-keyshortcuts.
dismissLabelstring
On TabThe accessible name of the close button, required whenever it is drawn. Name what closes: “Close customers.sql” rather than “Close”.
startReactNode
On TabContent before the label, such as an Icon, placed in the start part beside the words.
endReactNode
On TabContent after the label, such as a Badge with a count, placed in the end part beside the words.
controlsstring
On TabThe id of the region this tab controls when it is not a TabPanel, such as a table the selected value filters. aria-controls names that region.
hrefstring
On TabRenders the tab as a link. A plain click selects the tab without navigating; a click with a modifier key is left to the browser, which opens the address in a new browser tab or window.
value, on TabPanelstring
On TabPanelThe tab this panel belongs to. Tabs wires the pair with ids generated from the value.

Events

NamePayloadWhen
onValueChange(value: string, request: ChangeRequest<string | undefined>)Before the selection moves. The request carries the new value, the previous value (undefined while no tab is selected), the reason (pointer, keyboard, remove or programmatic), the originating event, and cancel(), which keeps the current tab.
onTabDismiss(value: string, request: TabsDismissRequest)Before a tab is closed, by Delete or by its close button. The request carries the reason (pointer or keyboard) and cancel(), which stops both the dismissal and the selection move that would follow it. Tabs removes nothing itself: remove the tab from your own data.
onClick, onKeyDown, onFocus, on each Tabthe element’s own eventsWhen the tab’s control fires them. Your handler runs first, and preventDefault() in onClick also stops the selection.

Composition

render(props) => ReactNode
On Tabs, TabList, Tab, TabPanel, TabActionsReplaces the root element of any of the five and passes it every attribute, so a list can be a nav and Tabs a section. The tab control itself cannot be replaced: it holds the role, the value and the keyboard, and href covers the substitution that matters.
refRef<HTMLElement>
On Tab, TabPanel, TabsOn Tab, reaches the tab’s own control, so focus() and click() are the element’s own methods and no imperative handle stands in for them.
useTabs()() => TabsContextValue
On inside TabsWhat a tab and a panel read: the value, shownValue (the value the panels render, deferred under deferPanels), the mount strategy, the ids, and select(value, reason, source) for a view the page changes on its own. A region rendered outside the panels — a page header’s tab with controls= — renders from shownValue. It throws outside Tabs instead of rendering a control that looks right and does nothing.
TabsDefaultsProvider{ activation, orientation, size, variant, track, fit, mount, loop }
On a subtreeThe eight settings an application decides once. A value set on one Tabs still wins.
aria-label, on TabListstring
On TabListThe name of the set of views. Tabs writes no name of its own; aria-labelledby works the same way.

Parts

PartElementRequiredPurpose
rootdiv, or the element render returnsYesThe Tabs root: a grid of four columns and two rows that carries data-ui="tabs", the axes (data-size, data-variant, data-track, data-orientation, data-fit), data-disabled, data-overflowing and data-activation-direction. It renders the two paging controls itself, because it observes whether the list overflows.
listdiv[role="tablist"], or the element render returnsYesThe scroll container, and the single Tab stop of the list. Name it with aria-label or aria-labelledby: Tabs writes neither, because only the page knows what the set of views is for.
itemdiv[role="presentation"], or the element the render of Tab returnsYesOne tab and its optional close button. It exists because a button cannot contain a button, and it carries the hover bar under the tab. className and style reach it.
tabbutton[role="tab"], or a[role="tab"] with hrefYesThe control. It holds aria-selected, aria-controls, the generated id and data-value, which the keyboard reads. Every other native prop and the ref reach it.
startspanNoThe content of start, before the label: an icon, as a flex item of the tab that never shrinks and that sizes an icon to the tab’s icon step.
labelspanYesThe words, in a box of their own: text-overflow cuts it when fit="equal" leaves too little room, and unicode-bidi: plaintext lets a label in another script read in its own direction.
endspanNoThe content of end, after the label: a count or a status, as a flex item of the tab that never shrinks.
dismissbuttonNoThe close button. It has tabindex="-1", so the arrow keys move between tabs only, and it stays in the accessibility tree, so a screen reader can press it. From the keyboard, Delete closes the focused tab, which aria-keyshortcuts on the tab announces.
markerspan, aria-hiddenNoThe bar under the selected tab. The list draws one and slides it between tabs; it spans the tab’s content box, never the close button. --slotted-tabs-marker-size, --slotted-tabs-marker-radius, --slotted-tabs-marker-inset and --slotted-tabs-marker-offset (1px above the list’s edge) shape it, and the hover bar takes the same geometry at --slotted-tabs-hover-marker-opacity.
paneldiv[role="tabpanel"]YesThe content of one tab, with aria-labelledby pointing at its tab and tabindex="0". It carries the hidden attribute while another tab is selected. The panel element always exists, so every tab’s aria-controls names an element; mount decides whether its content exists.
scrollbuttonNoOne paging control at each end, drawn only while the list overflows. It is aria-hidden and outside the Tab sequence, because the arrow keys reach every tab and scroll it into view.
actionsdiv, or the element render returnsNoA slot at the end of the tab row, for controls that act on what the tabs show. Put a Toolbar in it: one Tab stop however many buttons it holds.

Theming

Each token is a CSS custom property: set it in a theme, or on any element to retune every tabs inside it.

Tabs tokens

TokenDefault
--slotted-tabs-actions-gapvar(--slotted-space-4, 0.5rem)
--slotted-tabs-active-backgroundvar(--slotted-tone-secondary-subtle-active)
--slotted-tabs-active-marker-colorvar(--slotted-text)
--slotted-tabs-colorvar(--slotted-text-muted, GrayText)
--slotted-tabs-contained-backgroundvar(--slotted-surface-sunken)
--slotted-tabs-contained-selected-backgroundvar(--slotted-surface)
--slotted-tabs-dismiss-active-backgroundvar(--slotted-tone-secondary-subtle-active)
--slotted-tabs-dismiss-active-colorvar(--slotted-text, CanvasText)
--slotted-tabs-dismiss-colorvar(--slotted-text-muted, GrayText)
--slotted-tabs-dismiss-hover-backgroundvar(--slotted-tone-secondary-subtle-hover)
--slotted-tabs-dismiss-hover-colorvar(--slotted-text, CanvasText)
--slotted-tabs-fade-sizevar(--slotted-space-6, 1rem)
--slotted-tabs-gapvar(--slotted-space-6, 1rem)
--slotted-tabs-hover-backgroundvar(--slotted-tone-secondary-subtle-hover)
--slotted-tabs-hover-colorvar(--slotted-text, CanvasText)
--slotted-tabs-hover-marker-colorvar(--slotted-border-strong)
--slotted-tabs-hover-marker-opacity0.5
--slotted-tabs-list-gapvar(--_list-gap)
--slotted-tabs-marker-colorvar(--slotted-tone-accent-solid)
--slotted-tabs-marker-easingcubic-bezier(0.4, 0, 0.2, 1)
--slotted-tabs-marker-insetvar(--_padding-inline)
--slotted-tabs-marker-offset1px
--slotted-tabs-marker-radiusvar(--slotted-radius-full, 9999px)
--slotted-tabs-marker-size3px
--slotted-tabs-scroll-colorvar(--slotted-text-muted, GrayText)
--slotted-tabs-selected-colorvar(--slotted-tone-accent-text)
--slotted-tabs-track-colorvar(--slotted-border-subtle, ButtonBorder)

Theme tokens it reads

TokenDefault
--slotted-border-strongSet per scheme by the theme
--slotted-border-subtleSet per scheme by the theme
--slotted-border-width-thick2px
--slotted-border-width-thin1px
--slotted-control-font-familyvar(--slotted-font-family-sans)
--slotted-control-font-size-lgcomfortable 14px · compact 13px · dense 12px
--slotted-control-font-size-mdcomfortable 13px · compact 12px · dense 12px
--slotted-control-font-size-smcomfortable 12px · compact 12px · dense 12px
--slotted-control-font-weightvar(--slotted-font-weight-semibold)
--slotted-control-gap-lgcomfortable 8px · compact 6px · dense 6px
--slotted-control-gap-mdcomfortable 8px · compact 6px · dense 4px
--slotted-control-gap-smcomfortable 6px · compact 4px · dense 4px
--slotted-control-height-lgcomfortable 38px · compact 32px · dense 30px
--slotted-control-height-mdcomfortable 34px · compact 28px · dense 26px
--slotted-control-height-smcomfortable 30px · compact 26px · dense 24px
--slotted-control-icon-size-lgcomfortable 18px · compact 16px · dense 14px
--slotted-control-icon-size-mdcomfortable 16px · compact 14px · dense 13px
--slotted-control-icon-size-smcomfortable 14px · compact 13px · dense 12px
--slotted-control-inner-size-lgcomfortable 28px · compact 24px · dense 22px
--slotted-control-inner-size-mdcomfortable 24px · compact 20px · dense 18px
--slotted-control-inner-size-smcomfortable 22px · compact 18px · dense 16px
--slotted-control-letter-spacing0
--slotted-control-line-height1
--slotted-control-padding-inline-lgcomfortable 16px · compact 12px · dense 10px
--slotted-control-padding-inline-mdcomfortable 13px · compact 10px · dense 8px
--slotted-control-padding-inline-smcomfortable 10px · compact 8px · dense 6px
--slotted-control-radiusvar(--slotted-radius-sm)
--slotted-control-transition-durationvar(--slotted-duration-short)
--slotted-control-transition-easingvar(--slotted-easing-standard)
--slotted-disabled-backgroundSet per scheme by the theme
--slotted-disabled-borderSet per scheme by the theme
--slotted-disabled-foregroundSet per scheme by the theme
--slotted-duration-medium200ms
--slotted-duration-short120ms
--slotted-easing-entercubic-bezier(0.05, 0.7, 0.1, 1)
--slotted-focus-ring-colorSet per scheme by the theme
--slotted-focus-ring-offsetvar(--slotted-border-width-thick)
--slotted-focus-ring-widthvar(--slotted-border-width-thick)
--slotted-radius-full9999px
--slotted-radius-md6px
--slotted-radius-sm4px
--slotted-shadow-xsSet per scheme by the theme
--slotted-space-10.125rem
--slotted-space-20.25rem
--slotted-space-40.5rem
--slotted-space-61rem
--slotted-surfaceSet per scheme by the theme
--slotted-surface-sunkenSet per scheme by the theme
--slotted-target-comfortable44px
--slotted-target-min24px
--slotted-textSet per scheme by the theme
--slotted-text-mutedSet per scheme by the theme
--slotted-tone-accent-solidSet per scheme by the theme
--slotted-tone-accent-textSet per scheme by the theme
--slotted-tone-secondary-subtle-activeSet per scheme by the theme
--slotted-tone-secondary-subtle-hoverSet per scheme by the theme