Tabs
Tabs are interactive elements that work alongside Tab and Tab Panel to organise content into separate sections or views.
import '@vonage/vivid/tabs';
import '@vonage/vivid/tab';
import '@vonage/vivid/tab-panel';
or, if you need to use a unique prefix:
import { registerTabs, registerTab, registerTabPanel } from '@vonage/vivid';
registerTabs('your-prefix');
registerTab('your-prefix');
registerTabPanel('your-prefix');
<script setup lang="ts">
import { VTabs, VTab, VTabPanel } from '@vonage/vivid-vue';
</script>
<template>
<VTabs>
<VTab label="Tab one"></VTab>
<VTab label="Tab two"></VTab>
<VTab label="Tab three"></VTab>
<VTabPanel>Tab Panel one</VTabPanel>
<VTabPanel>Tab Panel two</VTabPanel>
<VTabPanel>Tab Panel three</VTabPanel>
</VTabs>
</template>
The icon
slot on the Tab component can be used to display a custom icon. If set, the icon
attribute is ignored.
The action-items
slot on the Tabs component can be used to add action items after the last Tab in the tabs bar.
In the example below, a Button is provided that adds a new Tab when clicked.
Use the --tabs-block-size
CSS variable to set the block-size of the base
element.
When using Tabs inside flex structure, setting --tabs-block-size: 100%
with flex:1
or with any specific block-size on Tabs will stretch the tabs to full height.
Use the CSS part tab-panel
to provide custom styling to the Tab Panel components.
Properties
Name | Type | Description |
---|---|---|
activeid | string |
Match with an id set on a Tab to mark it as active on initial load |
connotation | accent (default), cta |
Sets the connotation color of the active tab |
gutters | none , small (default) |
Sets the spacing inside the Tab Panels |
orientation | horizontal (default), vertical |
Sets axis on which the tabs are aligned |
scrollable-panel | boolean |
Sets whether the Tab Panel will be scrollable (if content height exceeds block-size ) |
Slots
Name | Description |
---|---|
default | For Tab and Tab Panel components |
action-items | To add action items after the last Tab in the tabs bar |
Events
Name | Type | Bubbles | Composed | Description |
---|---|---|---|---|
change |
CustomEvent<HTMLElement> |
Yes | Yes | Fired when a tab is clicked or during keyboard navigation |
Properties
Name | Type | Description |
---|---|---|
disabled | boolean |
Sets the disabled state |
(deprecated as of 05/25) icon |
Enum: [icon-name] |
A decorative icon the custom element should have. See the Vivid Icon Gallery for available icons and icon-names |
icon-trailing | boolean |
Places the icon after the label text |
label | string |
Sets the label text |
removable | boolean |
Adds a close button |
shape | rounded (default), sharp |
Shape of the background when hovered |
Slots
Name | Description |
---|---|
icon | For custom icons |
Events
Name | Type | Bubbles | Composed | Description |
---|---|---|---|---|
close | CustomEvent |
Yes | Yes | When removable is set, fired when the close button is clicked or the DELETE key is pressed |
Slots
Name | Description |
---|---|
default | For Tab Panel content |