# @hiro0218/accordion.js

> Accordion Menu Library

Latest version **0.1.3** (published 2019-07-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @hiro0218/accordion.js
pnpm add @hiro0218/accordion.js
yarn add @hiro0218/accordion.js
bun add @hiro0218/accordion.js
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2019-07-11 |
| First published | 2019-07-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | hiro |
| Maintainers | hiro0218 |
| Keywords | accordion, javascript |

## Links

- npm: https://www.npmjs.com/package/@hiro0218/accordion.js
- Repository: https://github.com/hiro0218/accordion.js
- Homepage: https://github.com/hiro0218/accordion.js#readme
- Issues: https://github.com/hiro0218/accordion.js/issues
- npm.io page: https://npm.io/package/@hiro0218/accordion.js

## Recent versions

- 0.1.3 (latest) — 2019-07-11
- 0.1.2 — 2019-07-11
- 0.1.1 — 2019-07-11
- 0.1.0 — 2019-07-11

## README

# @hiro0218/accordion.js

## install

```
npm install -D @hiro0218/accordion.js
```

## usage

### HTML

Opening and closing moves independently.

```html
<div data-accordion>
  <h2 data-accordion-header aria-expanded="false">TITLE</h2>
  <div data-accordion-container>
    CONTENTS
  </div>
</div>
```

---

Opening and closing interlocks.

```html
<div data-accordion="alone">
  <h2 data-accordion-header aria-expanded="false">TITLE</h2>
  <div data-accordion-container>
    CONTENTS
  </div>
</div>
```

### CSS

```scss
[data-accordion] {
  [data-accordion-header] {
    cursor: pointer;
    user-select: none;
  }
  
  [data-accordion-container] {
    overflow-y: hidden;
    max-height: 0;
    transition: max-height 0.6s ease;
  }

  // close
  [aria-expanded="false"] {}

  // open
  [aria-expanded="true"] {
    & ~ [data-accordion-container] {
      max-height: 200vh;
    }
  }
}
```

### JS

```js
import Accordion from '@hiro0218/accordion.js';
new Accordion();
```

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