Tabs ​

Divide data collections which are related yet belong to different types.

Basic usage ​

Basic and concise tabs.

Tabs provide a selective card functionality. By default the first tab is selected as active, and you can activate any tab by setting the value attribute.

User

Card Style ​

Tabs styled as cards.

Set type to card can get a card-styled tab.

User

Border card ​

Border card tabs.

Set type to border-card.

Tab position ​

You can use tab-position attribute to set the tab's position.

You can choose from four directions: tabPosition="left|right|top|bottom"

Custom Tab ​

You can use named slot to customize the tab label content.

Add & close tab ​

Only card type Tabs support addable & closeable.

Tab 2 content

Customized add button icon 2.4.0 ​

Tab 2 content

Customized trigger button of new tab ​

Tab 2 content

Default value 2.11.9 ​

default-value: third
active:

Tabs API ​

Tabs Attributes ​

NameDescriptionTypeDefault
model-value / v-modelbinding value, name of the selected tab, the default value is the name of first tabstring / number—
default-value 2.11.9The value of the tab that should be active when initially rendered. (avoid initial transition)string / number—
typetype of Tabenum''
closablewhether Tab is closablebooleanfalse
addablewhether Tab is addablebooleanfalse
editablewhether Tab is addable and closablebooleanfalse
tab-positionposition of tabsenumtop
stretchwhether width of tab automatically fits its containerbooleanfalse
before-leavehook function before switching tab. If false is returned or a Promise is returned and then is rejected, switching will be preventedFunction() => true
tabindex 2.11.7tabs tabindexstring / number0

Tabs Events ​

NameDescriptionParameters
tab-clicktriggers when a tab is clickedFunction
tab-changetriggers when activeName is changedFunction
tab-removetriggers when tab-remove button is clickedFunction
tab-addtriggers when tab-add button is clickedFunction
edittriggers when tab-add button or tab-remove is clickedFunction

Tabs Slots ​

NameDescriptionSubtags
defaultcustomize default contentTab-pane
add-icon 2.5.4customize add button icon—
addIcon 2.4.0 deprecatedcustomize add button icon—

Tabs Exposes ​

NameDescriptionType
currentNamecurrent active pane nameobject
tabNavRef 2.9.10tab-nav component instanceobject

Tab-nav API ​

Tab-nav Exposes ​

NameDescriptionType
scrollToActiveTabscroll to the active tabFunction
removeFocusremove focus statusFunction
tabListRef 2.9.10el_tabs__nav html elementobject
tabBarRef 2.9.10el_tabs__nav bar instanceobject

Tab-bar API ​

Tab-bar Exposes ​

NameDescriptionType
ref 2.9.10tab root html elementobject
update 2.9.10method to manually update tab bar style, return the updated styleFunction

Tab-pane API ​

Tab-pane Attributes ​

NameDescriptionTypeDefault
labeltitle of the tabstring''
disabledwhether Tab is disabledbooleanfalse
nameidentifier corresponding to the name of Tabs, representing the alias of the tab-pane, the default is ordinal number of the tab-pane in the sequence, e.g. the first tab-pane is '0'string / number—
closablewhether Tab is closablebooleanfalse
lazywhether Tab is lazily renderedbooleanfalse

Tab-pane Slots ​

NameDescription
defaultTab-pane's content
labelTab-pane's label

FAQ ​

How to use sortable/draggable tabs ? ​

We exposed the necessary information to implement it yourself. You can use a native way to do it, demo. Or using SortableJs, demo.

Source ​

Component • Style • Docs

Contributors ​