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
属性
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| 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. |
| className | string | "" | |
| color | KunUIColor | "primary" | |
| disableAnimation | boolean | false | |
| disabled | boolean | false | |
| fullWidth | boolean | false | |
| iconSize | string | "1em" | |
| innerClassName | string | "" | |
| name | string | — | 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. |
| orientation | KunTabOrientation | "horizontal" | |
| scrollable | boolean | false | Horizontal 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. |
| scrollButtons | boolean | true | When 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. |
| size | KunTabSize | "md" | |
| variant | KunTabVariant | "underlined" |
事件
| 事件 | 回调参数 |
|---|---|
| change | value: string |
| update:modelValue | value: string |
插槽
| 插槽 | 作用域 |
|---|---|
| #tab | { item: KunTabItem; index: number; active: boolean; } |