1.0.14 • Published 5 years ago

simple-react-accordion v1.0.14

Weekly downloads
12
License
MIT
Repository
-
Last release
5 years ago

Simple React Accordion

A simple React accordion component that takes an array of JavaScript objects and processes it into a responsive accordion element.

Very simple, easy to implement, and features 5 pre-built themes.

View demo page here

#Installation

Install with npm

npm install simple-react-accordion --save

or install with Yarn

yarn add simple-react-accordion

How to use

Import the module in your React app.

import SimpleAccordion from 'simple-react-accordion';

Define your accordionItems either as a state or variable.

/// Using state
class App extends Component {
  constructor() {
    super();

    this.state = {
      accordionItems: [
        {
          header: "This is the 1st item.",
          content: "Some content."
        },
        {
          header: "This is the 2nd item.",
          content: "Some more content."
        },
        {
          header: "This is the 3rd item.",
          content: "Even some more content!"
        }
      ]
    }
  }
}

Invoke the component with your items.

render() {
  return(
    <div className="container">
      <SimpleAccordion 
        theme="professional"
        items={this.state.accordionItems}
      />
    </div>
  )
}

Preview

Theme used in photo is professional.

demo image of accordion

Properties

PropertytypeOptionsDefaultDescription
themestringbasic, minimal, well, professional, darkbasicSets the theme style.
itemsarrayArray of Objects. Objects require header and content properties.

View Github Repository

Follow the developer on Instagram

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago