1.0.1 • Published 4 years ago

simple-accordion-test v1.0.1

Weekly downloads
4
License
ISC
Repository
-
Last release
4 years ago

How to use this component

As the name suggest, this is a simple accordion component. Nothing fancy!

Installation:

npm install simple-accordion-test

Props

Accordion.propTypes = {
  allowMultipleOpen: bool,
  sections: [
    {
        body: string || node,
        title: string || node,
        defaultOpen: bool
    }
  ]
};

Default props:

Accordion.defaultProps = {
  allowMultipleOpen: false,
  sections: [{ title: "Title", body: "Body" }]
};

Usage

import SimpleAccordion from "simple-accordion-test";
import 'simple-accordion-test/src/Accordion.css'

...

render() {
    const accordionSections = [
        {
            title: "Section 1",
            body: "some section",
            defaultOpen: true
        },
        {
            title: "Section 2",
            body: "some other section",
            defaultOpen: false
        },
    ];
    return <SimpleAccordion section={accordionSections}/>;
}