# react-gj-accordion

> A simple accordion component for react with smooth animation and having no external dependencies.

Latest version **2.0.0** (published 2026-02-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-gj-accordion
pnpm add react-gj-accordion
yarn add react-gj-accordion
bun add react-gj-accordion
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2026-02-25 |
| First published | 2022-12-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 0 |
| Unpacked size | 19 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Gaurav Joshi |
| Maintainers | gauravj09 |
| Keywords | react-accordion, accordion, collapsible, foldable, react, typescript, react-gj-accordion |

## Links

- npm: https://www.npmjs.com/package/react-gj-accordion
- npm.io page: https://npm.io/package/react-gj-accordion

## 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

- 2.0.0 (latest) — 2026-02-25
- 1.0.6 — 2023-08-17
- 1.0.5 — 2023-08-17
- 1.0.4 — 2023-01-20
- 1.0.3 — 2022-12-24
- 1.0.2 — 2022-12-24
- 1.0.1 — 2022-12-24
- 1.0.0 — 2022-12-24

## README

## react-gj-accordion

A simple accordion component for react with smooth animation and having no external dependencies.

## Demo

https://codesandbox.io/s/react-typescript-forked-l8f927


## Installation

Install the package with npm:

```bash
  npm install react-gj-accordion
```

## Usage/Examples

```javascript
import React from 'react';
import { Accordion, AccordionHeader, AccordionBody, AccordionItem } from "react-gj-accordion";

const App = () => {
    return (
    <Accordion>
        <AccordionItem>
            <AccordionHeader>
              <strong>What is HTML</strong>
            </AccordionHeader>
            <AccordionBody>
              HTML is the standard markup language for Web pages. With HTML you can
              create your own Website.
            </AccordionBody>
        </AccordionItem>
        <AccordionItem>
            <AccordionHeader>
              <strong>What is CSS</strong>
            </AccordionHeader>
            <AccordionBody>
              <em>
                CSS is the language we use to style an HTML document. CSS describes
                how HTML elements should be displayed.
              </em>
            </AccordionBody>
        </AccordionItem>
        <AccordionItem>
            <AccordionHeader>
              <strong>What is React</strong>
            </AccordionHeader>
            <AccordionBody>
              React is a JavaScript library created by Facebook. It is a User
              Interface (UI) library for building UI components.
            </AccordionBody>
        </AccordionItem>
    </Accordion>
  );
}

export default App;

```
## API Summary

#### Accordion

| Parameter | Type     | Description                |
| :-------- | :------- | :------------------------- |
| `allowMultipleExpanded` | `boolean` | don't autocollapse items when expanding other items. |
| `preExpanded` | `number[]` | array of number based on which items will be expanded on mount. (0 for the first item & so on). |
| `expandAll` | `boolean` | all items will be expanded on mount. |

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