universe:react-accordion

v0.1.1Published 8 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

Universe Accordion

React accordion component

Installation

meteor add universe:react-accordion

Demo

Checkout the demo

Usage

Components of this package use universe:modules package for import/export. So you can import it by es6 import api import {Accordion, AccordionItem} from '{universe:react-accordion}' or by System.import('universe:react-accordion').then(function(module){/* your code */}) in regular js.

In CoffeeScript you can use package universe:modules-for-coffee

1
2import {Accordion, AccordionItem} from '{universe:react-accordion}';
3
45
6	render: function () {
7	    const title = <h3>{item.label}</h3>;
8		return (
9			<Accordion>
10				{[1, 2, 3, 4, 5].map((item) => {
11					return (
12						<AccordionItem title={title} key={item}>
13							<div>
14								{`Item ${ item } content`}
15								{item === 3 ? <p><img src="https://cloud.githubusercontent.com/assets/38787/8015584/2883817e-0bda-11e5-9662-b7daf40e8c27.gif" /></p> : null}
16							</div>
17						</AccordionItem>
18					);
19				})}
20			</Accordion>
21		);
22	}
23

options / PropTypes

  • allowMultiple: allow multiple items to be open at the same time (default: false)
  • activeItems: receives either an array of indexes or a single index. Each index corresponds to the item order, starting from 0. Ex: activeItems={0}, activeItems=[0, 1, 2]

License

This package is released under the MIT license.

Written based on the wonderful: daviferreira/universe-accordion