Skip to content

TabComponent

A horizontal tab bar with icon support, active state highlighting, and optional close/remove tab functionality. Renders only tabs with show !== false.

Basic Usage

Demo
Active tab: profile

With Protected (Disabled) Tabs

Protected Tabs

Props

Props
PropTypeDefaultDescription
tabsrequiredGeneralTabsProfile[]Array of tab definitions. Each item must have key, label, icon, and show.
modelValuerequiredstringThe key of the currently active tab. Use with v-model.
protectedTabsstring[][]Array of tab keys that are disabled when their enabled property is false.

Tab Object Shape

ts
interface GeneralTabsProfile {
  key: string            // Unique identifier, used as modelValue
  label: string          // Display text
  icon: string           // Lucide icon name (e.g. 'User', 'Calendar')
  show?: boolean         // Hide tab entirely when false (default: true)
  enabled?: boolean      // Used with protectedTabs to disable a tab
  tooltip?: string       // Optional tooltip on hover
  removeTab?: boolean    // Show ✕ button to close the tab
  command?: () => void   // Custom function to run on click (skips tab switching)
}

Emits

Emits
EventPayloadDescription
update:modelValuestringEmitted when the user clicks a tab. Value is the clicked tab's key.
remove-tabstring | numberEmitted when the user clicks the ✕ remove button on a tab (requires removeTab: true on the tab).

Slots

Slots
SlotDescription
actionsContent placed in the right side of the tab bar. Useful for action buttons.
getbackAdditional right-side slot for back/return navigation.

Built with VitePress