Skip to content
🌏 Translated with the assistance of DeepSeek and ChatGPT

Tab

Switch between different content areas via tabs.

Controlled & Uncontrolled

Use active to control the currently active tab, which supports v-model (controlled mode). When active is undefined or not passed, it operates in uncontrolled mode, and the default value can be set via defaultActive.

Content of Tab 1

Active: 1

Hide source code

Variant, Placement & Justify

Use the variant prop to set the tab style, supporting "line" (default) and "card".

Use the placement prop to set the tab header position, supporting "top" (default), "bottom", "left", and "right".

Use the justify prop to set the tab header alignment, supporting "start" (default), "center", and "end".

Variant:
Placement:
Justify:

Content of Tab A

Hide source code

Disabled

Disable individual tabs via the disabled prop on TabPanel. Disabled tabs cannot be clicked to switch or closed.

Content of Tab 1

Hide source code

Create & Close Tabs

Enable the create tab functionality via the creatable prop. Clicking the add button triggers the create event. Use the onCreate callback to implement the creation logic.

Enable the close functionality on tabs via the closable prop on TabPanel or TabItem. Clicking the close icon triggers the close event.

Content of Tab 1

Hide source code

Icon

Use the icon slot on TabPanel to add icons to tabs.

Home content

Hide source code

Prefix & Suffix

Use the prefix and suffix slots to add custom content before and after the tab header.

Content A

Hide source code

Header Only

Use TabItem as children to render only the tab headers without content panels.

Hide source code

API

TabProps

AttributeTypeOptionalDefaultDescriptionVersion
activenumber | string | symbol | nullTrueThe index of the currently active tab. Supports controlled mode via v-model.0.2.0
defaultActivenumber | string | symbol | nullTrueDefault value for the active tab index in uncontrolled mode.0.2.0
variant'line' | 'card'True'line'Tab style variant.0.2.0
creatablebooleanTruefalseWhether to show the add tab button.0.2.0
placement'top' | 'bottom' | 'left' | 'right'True'top'Tab header position.0.2.0
justify'start' | 'center' | 'end'True'start'Tab header alignment.0.2.0
tabMinWidthnumber | stringTrue60Minimum width of the tab title. Only effective when placement is left or right.0.2.0
tabMaxWidthnumber | stringTrue160Maximum width of the tab title. Only effective when placement is left or right.0.2.0
pollSizeChangebooleanTruefalseEnable polling for component size changes, which may affect performance.0.2.0

TabEvents

EventParameterDescriptionVersion
update:activevalue: number | string | symbolCallback when active updates.0.2.0
selectindex: number | string | symbol, event: MouseEventCallback when a tab is selected.0.2.0
closeindex: number | string | symbol, event: MouseEventCallback when a tab is closed.0.2.0
createevent: MouseEventCallback when a tab is created.0.2.0

TabSlots

SlotParameterDescriptionVersion
defaultChild components of the tab, which can be TabPanel or TabItem.0.2.0
prefixContent to display before the tab header.0.2.0
suffixContent to display after the tab header.0.2.0

TabPanelProps

AttributeTypeOptionalDefaultDescriptionVersion
indexnumber | string | symbolFalseUnique identifier used to match the active tab.0.2.0
titlestringTrue''Tab title.0.2.0
disabledbooleanTruefalseWhether the tab is disabled.0.2.0
closablebooleanTruefalseWhether to show the close icon.0.2.0

TabPanelSlots

SlotParameterDescriptionVersion
defaultTab content.0.2.0
iconTab icon.0.2.0

TabItemProps

AttributeTypeOptionalDefaultDescriptionVersion
indexnumber | string | symbolFalseUnique identifier.0.2.0
titlestringTrue''Tab title.0.2.0
disabledbooleanTruefalseWhether the tab is disabled.0.2.0
closablebooleanTruefalseWhether to show the close icon.0.2.0

TabItemSlots

SlotParameterDescriptionVersion
defaultTab title content.0.2.0
iconTab icon.0.2.0