humanonlyweb/ui

Tabs

Panels switched by tabs.

Markdown

Examples

Basic

A summary of the project.

Copy code

Counts

The tab slot replaces each tab's text, e.g. to add a count.

12 issues.

Copy code

API

PropTypeDefault
items

Tabs to render, in order.

SelectOption<T>[][]
label

Accessible name for the tablist.

string—
disabled

Disables every tab.

booleanfalse
modelValue

The selected tab's value.

T—
EventPayload
update:modelValue

v-model:modelValue update.

[value: T | undefined]
SlotProps
default

Panel content for the selected tab.

{ value: T | undefined; }
tab

Tab content.

{ item: SelectOption<T>; selected: boolean; }

Types

export interface SelectOption<T extends SelectValue = SelectValue> {
  label: string;
  value: T;
  disabled?: boolean;
}

export type SelectValue = string | number;
Copy code

Styling

--ui-indicator-x, --ui-indicator-width, --ui-indicator-top and --ui-indicator-height place the indicator on the selected item.

Parts
tabstablisttab-indicatortabtabpanel
States
data-tabs-slidingdata-tabs-animatedata-tab-selected

Keyboard

KeysAction
TabFocus the selected tab, then the panel
← / →Select the previous / next tab
Home / EndSelect the first / last tab

Accessibility

  • In right-to-left layouts, ← / → follow the visual direction.