# @gluestack-ui/accordion

> A universal headless accordion component for React Native, Next.js & React

Latest version **1.0.14** (published 2025-03-11) · 49.6K weekly downloads

## Install

```sh
npm install @gluestack-ui/accordion
pnpm add @gluestack-ui/accordion
yarn add @gluestack-ui/accordion
bun add @gluestack-ui/accordion
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.0.14 |
| Published | 2025-03-11 |
| First published | 2023-11-08 |
| Weekly downloads | 49.6K |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 35 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5307 |
| Maintainers | vidhi499, rohit_singh, viraj-10, rayan1810, rajat693, surajahmedc, meenumakkar, madhavb230100, vaibhk002, daminipandey, amars29, geekgautam, sravankumarvelangi, gluestackadmin, geekashwini, mayankp06 |
| Keywords | react, native, react-native, accordion, gluestack-ui, universal, headless, typescript, component, android, ios, nextjs |

## Links

- npm: https://www.npmjs.com/package/@gluestack-ui/accordion
- Repository: https://github.com/gluestack/gluestack-ui
- Homepage: https://github.com/gluestack/gluestack-ui/tree/main/packages/unstyled/accordion#readme
- Issues: https://github.com/gluestack/gluestack-ui/issues
- npm.io page: https://npm.io/package/@gluestack-ui/accordion

## Dependencies (4)

- [@gluestack-ui/utils](https://npm.io/package/@gluestack-ui/utils.md) ^0.1.15
- [@react-native-aria/focus](https://npm.io/package/@react-native-aria/focus.md) ^0.2.9
- [@react-native-aria/accordion](https://npm.io/package/@react-native-aria/accordion.md) ^0.0.2
- [@react-native-aria/interactions](https://npm.io/package/@react-native-aria/interactions.md) 0.2.16

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.14 (latest) — 2025-03-11
- 0.0.2-alpha.0 (alpha) — 2023-11-08
- 1.0.13 — 2025-03-03
- 1.0.12 — 2025-02-19
- 1.0.11 — 2025-02-18
- 1.0.10 — 2025-02-18
- 1.0.9 — 2025-02-18
- 1.0.8 — 2024-11-11
- 1.0.7 — 2024-09-03
- 1.0.6 — 2024-08-21
- 1.0.5 — 2024-07-08
- 1.0.4 — 2024-04-03
- 1.0.3 — 2024-03-21
- 1.0.2 — 2024-03-18
- 1.0.1 — 2024-02-12
- … 4 more at https://npm.io/package/@gluestack-ui/accordion/versions

## README

# `@gluestack-ui/accordion`

The Accordion component is a versatile and interactive user interface element, designed to efficiently organize and present content in a compact space.

## Installation

To install the component, run the following command in your terminal. This will add the component to your project's dependencies and allow you to use it in your project.

```sh
npx install @gluestack-ui/accordion
```

## Usage

```jsx
// import the styles
import {
  Root,
  Item,
  Header,
  Trigger,
  Content,
  Icon,
  TitleText,
  ContentText,
} from '../components/core/accordion/styled-components';

// import the createAccordion function
import { createAccordion } from '@gluestack-ui/accordion';

// Understanding the API
const Accordion = createAccordion({
  Root,
  Item,
  Header,
  Trigger,
  Content,
  Icon,
  TitleText,
  ContentText,
});

// Using the Accordion component
export default () => (
  <Accordion>
    <AccordionItem value="a">
      <AccordionHeader>
        <AccordionTrigger>
          {({ isExpanded }: { isExpanded: boolean }) => {
            return (
              <>
                <AccordionTitleText>
                  How do I place an order?
                </AccordionTitleText>
                {isExpanded ? (
                  // ChevronUpIcon is imported from 'lucide-react-native'
                  <AccordionIcon as={ChevronUpIcon} />
                ) : (
                  // ChevronDownIcon is imported from 'lucide-react-native'
                  <AccordionIcon as={ChevronDownIcon} />
                )}
              </>
            );
          }}
        </AccordionTrigger>
      </AccordionHeader>
      <AccordionContent>
        <AccordionContentText>
          Lorem ipsum dolor sit amet consectetur, adipisicing elit.
        </AccordionContentText>
      </AccordionContent>
    </AccordionItem>
  </Accordion>
);
```

More guides on how to get started are available
[here](https://ui.gluestack.io/docs/).

---
_Source: https://npm.io/package/@gluestack-ui/accordion · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
