# react-accordion-component

> Minimal UI Accordion component written in React

Latest version **1.0.10** (published 2015-07-31) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.10 |
| Published | 2015-07-31 |
| First published | 2015-07-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Saúl Cabrera |
| Maintainers | saulecabrera |
| Keywords | accordion, react-component, react-accordion, react-accordion-component, react-accordion-ui |

## Links

- npm: https://www.npmjs.com/package/react-accordion-component
- Repository: https://github.com/saulecabrera/react-accordion-component
- Issues: https://github.com/saulecabrera/react-accordion-component/issues
- npm.io page: https://npm.io/package/react-accordion-component

## Dependencies (1)

- [react](https://npm.io/package/react.md) ^0.13.3

## Recent versions

- 1.0.10 (latest) — 2015-07-31
- 1.0.9 — 2015-07-30
- 1.0.8 — 2015-07-30
- 1.0.7 — 2015-07-30
- 1.0.6 — 2015-07-30
- 1.0.5 — 2015-07-30
- 1.0.4 — 2015-07-30
- 1.0.3 — 2015-07-30
- 1.0.2 — 2015-07-30
- 1.0.1 — 2015-07-30
- 1.0.0 — 2015-07-30

## README

#React Accordion Component

![](public/logo.jpg)

#Installation
```sh
$ npm install react-accordion-component
```
  
#Usage
To get the basic style of the component, link in your `index.html` the CSS file for the Accordion:
```html
<link rel="stylesheet" href=/path/to/accordion.css>
```
(normally located under your `node_modules` directory)
 
 After that just require the component in the desired place of use:
 ```javascript 
 var Accordion = require('react-accordion-component');
 ```
 
 The `Accordion` accepts an array of objects, where each of them may have: 
 + `title`: title for an accordion element (`string`)
 + `onClick`: callback function triggered when an accordion element is clicked (`function`)
 + `content`: content for an accordion element (`string`)

##Example
```javascript
var elements = [];
elements.push({
    title: 'Element 1',
    onClick: function() {
      alert('Hello World!')
    },
    content: 'Lorem Ipsum...'
  });
  
elements.push({
  title: 'Element 2',
  onClick: function() {
  },
  content: 'Lorem Ipsum...'
});
```
When rendering (using `jsx`):
```javascript
React.render(<Accordion elements={elements} />, document.getElementById('accordion-example'));
```
##Voilà

Click in the [fish eye](http://www.fileformat.info/info/unicode/char/25c9/index.htm) to exapand/collapse each accordion element.
![](public/accordion_half.jpg) 

#Notes
In the `index.html` under `examples/` I've used Source Sans Pro font from Google Fonts. Feel free to change the font in `accordion.css` to your preferred font.

#TODO
+ Add `title` property to the accordion(e.g. `<Accordion elements={elements} title={title} />`
+ Add CSS animations
+ Add API to interact with elements
+ (Dev) Improve gulp file tasks

#License
MIT

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