Vivid API

Tabs

Tabs are interactive elements that work alongside Tab and Tab Panel to organise content into separate sections or views.

Usage

import { registerTabs, registerTab, registerTabPanel } from '@vonage/vivid-api';
registerTabs('your-prefix');
registerTab('your-prefix');
registerTabPanel('your-prefix');

Slots

Icon Slot

The icon slot on the Tab component can be used to display a custom icon. If set, the icon attribute is ignored.

Action Items Slot

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.

CSS Variables

Tabs Block Size

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.

CSS Parts

Tab Panel

Use the CSS part tab-panel to provide custom styling to the Tab Panel components.

API Reference

tabs

Properties

PropertyTypeDefaultDescription
activeidstringMatch with an `id` set on a Tab to mark it as active on initial load
activeindicatorbooleanDeprecated attribute. It has no effect.
connotation'accent' | 'cta'Sets the connotation color of the active tab
gutters'none' | 'small'Sets the spacing inside the Tab Panels
orientation'horizontal' | 'vertical'The orientation
scrollablePanelbooleanSets whether the Tab Panel will be scrollable (if content height exceeds `block-size`)
tabsLayout'align-start' | 'stretch'Controls the layout of the tabs.
PropertyTypeDefaultDescription
activeidstringMatch with an `id` set on a Tab to mark it as active on initial load
activeindicatorbooleanDeprecated attribute. It has no effect.
connotation'accent' | 'cta'Sets the connotation color of the active tab
gutters'none' | 'small'Sets the spacing inside the Tab Panels
orientation'horizontal' | 'vertical'The orientation
scrollable-panelbooleanSets whether the Tab Panel will be scrollable (if content height exceeds `block-size`)
tabs-layout'align-start' | 'stretch'Controls the layout of the tabs.

Slots

NameDescription
action-itemsSlot for action items such as buttons or controls.
defaultDefault slot for tab and tab-panel elements.
NameDescription
action-itemsSlot for action items such as buttons or controls.
defaultDefault slot for tab and tab-panel elements.

Events

NameTypeDescription
changeCustomEvent<HTMLElement>Fires a custom 'change' event when a tab is clicked or during keyboard navigation
NameTypeDescription
changeCustomEvent<HTMLElement>Fires a custom 'change' event when a tab is clicked or during keyboard navigation

Methods

NameParamsReturnsDescription
adjust
adjustment: number
voidAdjusts the active index by numerical increments. Only enabled tabs are considered.

tab

Properties

PropertyTypeDefaultDescription
connotation'accent' | 'cta'The connotation the tab should have.
disabledbooleanWhen true, the control will be immutable by user interaction. See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled | disabled HTML attribute for more information.
iconTrailingbooleanIndicates the icon affix alignment.
labelstringIndicates the tab's label.
removablebooleanAdds a close button
shape'rounded' | 'sharp'The shape the tab should have.
tabIndexnumber
PropertyTypeDefaultDescription
connotation'accent' | 'cta'The connotation the tab should have.
disabledbooleanWhen true, the control will be immutable by user interaction. See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled | disabled HTML attribute for more information.
icon-trailingbooleanIndicates the icon affix alignment.
labelstringIndicates the tab's label.
removablebooleanAdds a close button
shape'rounded' | 'sharp'The shape the tab should have.
tabindexnumber

Slots

NameDescription
iconThe preferred way to add an icon to the component.
NameDescription
iconThe preferred way to add an icon to the component.

tab-panel

Slots

NameDescription
defaultDefault slot.
NameDescription
defaultDefault slot.