外观
Accordion 手风琴
把相关内容分为带标题的折叠项,用于常见问题或分组说明。
import { SAccordion } from '@icecreamqaq/shadcn/accordion'使用示例
常用 API
| 成员 | 类型 | 用法 |
|---|---|---|
SAccordion.type | "single" | "multiple" | 选择同时允许展开一个或多个项目。 |
SAccordion.modelValue | string | string[] | 使用 v-model 同步展开项,multiple 模式对应数组。 |
SAccordion.collapsible | boolean | 允许单选模式下关闭已展开的最后一项,默认 false。 |
SAccordionItem.value | string | 每个条目在当前组内的唯一标识。 |
完整 API
Accordion16 个成员
属性
| 名称 | 类型 |
|---|---|
collapsible | boolean |
disabled | boolean |
dir | Direction |
orientation | DataOrientation |
unmountOnHide | boolean |
asChild | boolean |
as | AsTag | Component |
type | SingleOrMultipleType |
modelValue | string | string[] |
defaultValue | string | string[] |
items | readonly CollectionItem<string>[] |
renderLabel | RenderContent<{ item: CollectionItem<string>; }> |
事件
| 名称 | 类型 |
|---|---|
update:modelValue | ((value: string | string[] | undefined) => any) |
插槽
| 名称 | 类型 |
|---|---|
default | ((props: { modelValue: AcceptableValue | AcceptableValue[] | undefined; }) => any) |
label | ((props: { item: CollectionItem<string>; }) => any) |
content | ((props: { item: CollectionItem<string>; }) => any) |
AccordionContent5 个成员
属性
| 名称 | 类型 |
|---|---|
forceMount | boolean |
asChild | boolean |
as | AsTag | Component |
class | ClassValue |
插槽
| 名称 | 类型 |
|---|---|
default | ((props: {}) => any) |
AccordionItem7 个成员
属性
| 名称 | 类型 |
|---|---|
disabled | boolean |
value 必填 | string |
asChild | boolean |
as | AsTag | Component |
unmountOnHide | boolean |
class | ClassValue |
插槽
| 名称 | 类型 |
|---|---|
default | ((props: { open: boolean; }) => any) |
AccordionTrigger5 个成员
属性
| 名称 | 类型 |
|---|---|
asChild | boolean |
as | AsTag | Component |
class | ClassValue |
插槽
| 名称 | 类型 |
|---|---|
default | ((props: {}) => any) |
icon | ((props: {}) => any) |
分组导出
模板标签为 <s-accordion>。
组件 SAccordion、SAccordionContent、SAccordionItem、SAccordionTrigger