Tab (标签页)

标签页(v-model + items),支持多种变体与方向。

基础用法

Active tab: overview

Basic.vue

变体

underlined
solid
light
bordered
pills
Variants.vue

颜色

primary
secondary
success
warning
danger
info
default
Colors.vue

尺寸

sm
md
lg
Sizes.vue

垂直方向

Vertical.vue

溢出 · 自动滚动

横向 Tab 一旦放不下,会在容器内自动滚动而不是撑开页面——无需 scrollable 开关,也无需手动判断是否溢出。溢出的一侧用遮罩把标签 渐隐为透明(与背景色无关,任何底色都清晰),并在可滚动的一侧浮出 箭头;选中的标签会自动滚入可见区,方向键切换时始终可见。传 :scroll-buttons="false" 可只保留渐隐、去掉箭头。

Overflow.vue

图标

Icons.vue

对齐

start
center
end
Align.vue

禁用

item disabled
group disabled
Disabled.vue

内容面板

Overview — server-rendered into the HTML, indexable even when not active.
Specs — hidden="until-found" while inactive (findable via Ctrl+F).
Reviews — also server-rendered; deep-linkable via text fragments.
Panels.vue

懒加载 / 加载中

LazyLoading.vue

自定义标签 · 徽标 / 圆点(#tab 插槽)

Badge.vue

链接模式(每项一个页面)

给每一项传 href,标签就渲染成真正的 <a>:可被抓取、无 JS 也能用、⌘/Ctrl 点击会在新标签页打开。此时整条不再是 tablist 而是导航——它不会 再声明 role="tab" 与指向不存在面板的 aria-controls,而是 用 aria-current="page" 标记当前页,每个链接都能被 Tab 键逐个聚焦。 混排(部分项有 href)仍按 tablist 处理。

Link.vue

属性

属性类型默认值说明
items *KunTabItem[]—
modelValue *string—
align"start" | "end" | "center""center" (horizontal) / "start" (vertical)Horizontal alignment of each tab's content (icon + label) inside its box. Mainly visible on vertical / full-width tabs, where the box is wider than its content.
classNamestring""
colorKunUIColor"primary"
disableAnimationbooleanfalse
disabledbooleanfalse
fullWidthbooleanfalseFill the container's width. Horizontal tabs split it evenly, though none gets narrower than its label; when they do not fit, the strip scrolls as usual. In a vertical column every tab takes the full width. Either way, `align` places each label inside its tab.
iconSizestring"1em"
innerClassNamestring""
namestring—ARIA id namespace shared with <KunTabPanel> (so a tab links to its panel via aria-controls/labelledby). Set a distinct `name` per tab group on a page.
orientationKunTabOrientation"horizontal"
scrollablebooleanfalseHorizontal tabs ALWAYS contain their overflow (they scroll inside the container instead of widening the page) — no flag needed. This opts a *vertical* tab column into scrolling when it outgrows a bounded height.
scrollButtonsbooleantrueWhen a horizontal tab strip overflows, float a chevron button on each scrollable edge (in addition to the always-on edge fade). Set false to keep just the fade — the strip still scrolls via swipe / wheel / keyboard. Default true.
sizeKunTabSize"md"
variantKunTabVariant"underlined"

事件

事件回调参数
changevalue: string
update:modelValuevalue: string

插槽

插槽作用域
#tab{ item: KunTabItem; index: number; active: boolean; }