外观
Tabs 选项卡
在同一区域内切换相关内容,每个标签关联一个内容面板。
import { STabs } from '@icecreamqaq/shadcn/tabs'使用示例
常用 API
| 成员 | 类型 | 用法 |
|---|---|---|
STabs.modelValue | string | number | 使用 v-model 同步活动标签,也可以用 defaultValue 设置初始标签。 |
STabsTrigger.value / STabsContent.value | string | number | 使用相同的值关联标签按钮与内容面板。 |
STabs.activationMode | "automatic" | "manual" | 默认跟随键盘焦点激活,manual 模式下按回车或空格确认。 |
STabs.orientation | "horizontal" | "vertical" | 设置排列方向及对应的键盘方向键,默认 horizontal。 |
完整 API
Tabs15 个成员
属性
| 名称 | 类型 |
|---|---|
defaultValue | StringOrNumber |
orientation | DataOrientation |
dir | Direction |
activationMode | "automatic" | "manual" |
modelValue | StringOrNumber |
unmountOnHide | boolean |
asChild | boolean |
as | AsTag | Component |
items | readonly CollectionItem<string | number>[] |
renderLabel | RenderContent<{ item: CollectionItem<string | number>; }> |
class | ClassValue |
事件
| 名称 | 类型 |
|---|---|
update:modelValue | ((payload: StringOrNumber) => any) |
插槽
| 名称 | 类型 |
|---|---|
default | ((props: { modelValue: string | number | undefined; }) => any) |
label | ((props: { item: CollectionItem<string | number>; }) => any) |
content | ((props: { item: CollectionItem<string | number>; }) => any) |
TabsContent6 个成员
属性
| 名称 | 类型 |
|---|---|
value 必填 | StringOrNumber |
forceMount | boolean |
asChild | boolean |
as | AsTag | Component |
class | ClassValue |
插槽
| 名称 | 类型 |
|---|---|
default | ((props: {}) => any) |
TabsList5 个成员
属性
| 名称 | 类型 |
|---|---|
loop | boolean |
asChild | boolean |
as | AsTag | Component |
class | ClassValue |
插槽
| 名称 | 类型 |
|---|---|
default | ((props: {}) => any) |
TabsTrigger6 个成员
属性
| 名称 | 类型 |
|---|---|
value 必填 | StringOrNumber |
disabled | boolean |
asChild | boolean |
as | AsTag | Component |
class | ClassValue |
插槽
| 名称 | 类型 |
|---|---|
default | ((props: {}) => any) |
分组导出
模板标签为 <s-tabs>。
组件 STabs、STabsContent、STabsList、STabsTrigger