JGuang / JGuang UI
Components组件Radix UIRadix UI 组件

手风琴

以可折叠面板在有限空间中组织分组内容。

中文模式已适配导航、标题、简介、目录与常用章节名称。翻译状态:部分完成;技术正文目前仍为英文。
Loading JGuang UI example…

安装

Command

Manual

Use the JGuang UI Registry URL provided on /systems/jguang-ui#install.

安装以下依赖:

npm install radix-ui

将以下代码复制到你的项目中。

View complete source: components/ui/accordion.tsx

根据项目配置更新导入路径。

用法

import {
  Accordion,
  AccordionContent,
  AccordionItem,
  AccordionTrigger,
} from "@/components/ui/accordion"
<Accordion type="single" collapsible defaultValue="item-1">
  <AccordionItem value="item-1">
    <AccordionTrigger>Is it accessible?</AccordionTrigger>
    <AccordionContent>
      Yes. It adheres to the WAI-ARIA design pattern.
    </AccordionContent>
  </AccordionItem>
</Accordion>

Composition

Use the following composition to build an Accordion:

Accordion
├── AccordionItem
│   ├── AccordionTrigger
│   └── AccordionContent
└── AccordionItem
    ├── AccordionTrigger
    └── AccordionContent

Basic

A basic accordion that shows one item at a time. The first item is open by default.

Loading JGuang UI example…

Multiple

Use type="multiple" to allow multiple items to be open at the same time.

Loading JGuang UI example…

Disabled

Use the disabled prop on AccordionItem to disable individual items.

Loading JGuang UI example…

Borders

Add border to the Accordion and border-b last:border-b-0 to the AccordionItem to add borders to the items.

Loading JGuang UI example…

Card

Wrap the Accordion in a Card component.

Loading JGuang UI example…

从右到左布局

To enable RTL support in JGuang UI, see the RTL configuration guide.

Loading JGuang UI example…

API 参考

See the Radix UI documentation for more information.

来源: components/radix/accordion.mdx

JGuang UI 技术文档。

On this page