Tabs are a set of layered sections of content, known as tab panels, that display one panel of content at a time. Each tab panel has an associated tab element, that when activated, displays the panel. The list of tab elements is arranged along one edge of the currently displayed panel, most commonly the top edge.
WAI-ARIA
// npm
npm install @plinth-ui/tabs
// yarn
yarn add @plinth-ui/tabs
import { Tabs, TabList, Tab, TabPanels, TabPanel } from '@plinth-ui/tabs'
// Basic
<tabs>
<tab-list>
<tab>Tab 1</tab>
<tab>Tab 2</tab>
</tab-list>
<tab-panels>
<tab-panel>Panel 1</tab-panel>
<tab-panel>Panel 2</tab-panel>
</tab-panels>
</tabs>
// Controlled
<tabs v-model="activeTabValue">
<tab-list>
<tab>Tab 1</tab>
<tab>Tab 2</tab>
</tab-list>
<tab-panels>
<tab-panel>Panel 1</tab-panel>
<tab-panel>Panel 2</tab-panel>
</tab-panels>
</tabs>
Name |
Type |
Default |
Description |
as |
String |
div |
The element or component the Tabs should render as. |
v-model |
Number |
null |
Allows user to control which panel is open. |
Name |
Description |
default |
Expects TabList and TabPanels componenets as either direct children or descendants. |
Name |
Description |
update:modelValue |
Emits when the tab's state has changed. |
<tab-list>
<tab>Tab 1</tab>
<!-- ... -->
</tab-list>
Name |
Type |
Default |
Description |
as |
String |
div |
The element or component the TabList should render as. |
Name |
Description |
default |
Expects Tab componenets as either direct children or descendants. |
<tab
v-slot="{ active }"
:class="active ? 'tab--active' : 'tab--inactive'"
class="tab"
>
Click me!
</tab>
Name |
Type |
Default |
Description |
as |
String |
button |
The element or component the Tab should render as. |
Name |
Description |
default |
Use for the tab's content. |
<tab-panels>
<tab-panel>Panel 1</tab-panel>
<!-- ... -->
</tab-panels>
Name |
Type |
Default |
Description |
as |
String |
div |
The element or component the TabPanels should render as. |
Name |
Description |
default |
Expects TabPanel componenets as either direct children or descendants. |
<tab-panel>
The tab content.
</tab-panel>
Name |
Type |
Default |
Description |
as |
String |
div |
The element or component the TabPanel should render as. |
Name |
Description |
default |
Use for the panel's content. |