# Accordion · JGuang UI

> A vertically stacked set of interactive headings that each reveal a section of content.

- Page: https://jiguang132.com/systems/jguang-ui/docs/components/base/accordion
- Based on: shadcn/ui documentation (MIT) @ bc0705384b51252af26dcc65425b216bf5eb063c

> Example `accordion-demo`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/base/accordion


## Installation


  

**Command**


  

**Manual**


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


### Install the following dependencies:


```bash
npm install @base-ui/react
```


### Copy and paste the following code into your project.


[View complete source: components/ui/accordion.tsx](/r/jguang-ui/base/accordion.json)


### Update the import paths to match your project setup.


## Usage

```tsx showLineNumbers
import {
  Accordion,
  AccordionContent,
  AccordionItem,
  AccordionTrigger,
} from "@/components/ui/accordion"
```

```tsx showLineNumbers
<Accordion 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`:

```text
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.


> Example `accordion-basic`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/base/accordion


## Multiple

Use the `multiple` prop to allow multiple items to be open at the same time.


> Example `accordion-multiple`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/base/accordion


## Disabled

Use the `disabled` prop on `AccordionItem` to disable individual items.


> Example `accordion-disabled`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/base/accordion


## Borders

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


> Example `accordion-borders`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/base/accordion


## Card

Wrap the `Accordion` in a `Card` component.


> Example `accordion-card`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/base/accordion


## RTL

To enable RTL support in JGuang UI, see the [RTL configuration guide](/systems/jguang-ui/docs/rtl).


> Example `accordion-rtl`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/base/accordion


## API Reference

See the [Base UI](https://base-ui.com/react/components/accordion#api-reference) documentation for more information.

---

Index of all JGuang resources: https://jiguang132.com/llms.txt
