Skip to content

TabView-Demo


Data


  1. items
javascript
items = [
    {
        key: 'explorer',
        name: 'Explorer',
        title: 'Explorer',
        show: true,
        disabled: false,
        draggable: true,
        closable: true,
        icon: 'FolderHorizontal',
        img: ''
    }
]

Properties


PropertyTypeRequiredDefaultDescription
modelValueobjectNonullCurrently selected tab item.
itemsarrayNo[{ name: 'Tab' }]Tab item list. Each item usually uses key, name or title, plus optional icon, img, image, or src.
itemWidthnumber / stringNo180Unified width for every tab.
itemHeightnumber / stringNo38Tab height.
paddingstringNo''Outer padding of the component.
borderRadiusnumber / stringNo8Outer border radius.
foregroundstringNo''Text and icon color of normal tabs.
choosenForegroundstringNo''Text and icon color of the selected tab.
chooseBackgroundstringNo''Background of the selected tab.
backgroundstringNo''Background of the whole TabView.
hoverBackgroundstringNo''Background of a tab while hovering.
activeBackgroundstringNo''Background of a tab while active.
fontSizenumber / stringNo13Font size of the tab title.
imgBorderRadiusnumber / stringNo4Border radius for tab images.
draggablebooleanNotrueWhether tabs can be reordered by drag and drop.
closablebooleanNotrueWhether tabs show a close button by default. Items can set closable: false to opt out.
showAddButtonbooleanNofalseWhether to show the add button on the right side.
addButtonIconstringNo'Add'Fluent icon name used by the add button.
addButtonBackgroundstringNo''Background of the add button.
addButtonForegroundstringNo''Foreground color of the add button.
closeButtonIconstringNo'ChromeClose'Fluent icon name used by the close button.
closeIconSizenumber / stringNo10Icon size of the close button.
closeButtonForegroundstringNo''Foreground color of the close button.
overflowModestringNo'scroll'Overflow behavior for many tabs. Use scroll to keep tab width and enable horizontal scrolling, or shrink to compress tabs into one row.
themestringNo'global'Theme style. Supports global, light, dark, system, and custom.
disabledbooleanNofalseDisable the whole component.
langstringNo'global'Language option inherited from common props.

Emits


EventArgumentsDescription
update:modelValueobjectTriggered when the selected tab changes.
update:itemsarrayTriggered after close or drag reordering updates the tab list.
changeobjectTriggered when the selected tab changes.
addeventTriggered when the add button is clicked.
closeobjectTriggered when a tab is closed. Returns event, item, items, and index.
reorderobjectTriggered after drag reordering. Returns item, items, from, and to.

MIT Licensed