Skip to content

Tabs Component ​

Tabs Component

Tabs component allows users to switch between different views, serving as an important way for content organization and navigation, commonly used for categorized content display.

Basic Usage ​

Basic tabs usage, displaying the default line-style tabs.

Home Content
Show CodeArrow
CopyGitHub

Different Types ​

Tabs component provides three different types: line style (line), block style (block), and border style (border).

Line Style:
Block Style:
Border Style:
Show CodeArrow
CopyGitHub

Custom Gap ​

You can customize the gap between tabs by setting the gap attribute. When set to 0, tabs will fill the entire container.

Default Gap (gap=8):
Large Gap (gap=20):
Full Width (gap=0):
Show CodeArrow
CopyGitHub

Custom Height ​

You can customize the height of tabs by setting the height attribute.

Default Height (height=42px):
Small Size (height=32px):
Large Size (height=56px):
Show CodeArrow
CopyGitHub

Tabs with Icons ​

You can add icons to tabs by using the icon attribute on the TTabs component.

Home Content
Show CodeArrow
CopyGitHub

With Close Button ​

Set the is-close attribute to true to enable the close functionality for tabs.

Current Tab: tab1
Show CodeArrow
CopyGitHub

Disabled State ​

Set the disabled attribute on the TTabs component to disable specific tabs.

Currently Selected: tab1
Option 2 and Option 4 are disabled and cannot be selected
Show CodeArrow
CopyGitHub

Tabs API ​

TTabs Attributes ​

AttributeDescriptionTypeAccepted ValuesDefault
disabledWhether disabledboolean—false
valueTab valuestring/number——
iconTab iconstring——

TTabsGroup Attributes ​

AttributeDescriptionTypeAccepted ValuesDefault
v-modelBinding valuestring/number——
typeTab typestringline/block/borderline
heightTab heightstring—42px
gapTab gapnumber—8
is-closeWhether to show close buttonboolean—false
action-durationSwitch animation duration (ms)number—220

TTabsGroup Events ​

Event NameDescriptionParameters
changeTriggered when tab switches(value: ValueType)
closeTriggered when tab is closed(value: ValueType)

TTabsGroup Methods ​

Method NameDescriptionParameters
updateActionUpdate action position—

TTabs Slots ​

Slot NameDescription
defaultTab content

TTabsGroup Slots ​

Slot NameDescription
defaultPlace TTabs component

Style Variables ​

The tabs component uses the following style variables, which can be customized through SCSS variables:

Variable NameDescription
$theme-color-primaryTheme color - Primary
$theme-color-dangerTheme color - Danger
$text-color-defaultText color - Default
$font-size-defaultFont size - Default

Released under the MIT License