react-accordion-new

    1.1.0 • Public • Published

    React Accordion Box

    Accordion component for React.

    Sample Picture

    Install module

    > npm i react-accordion-new
    

    Usage

    import React from 'react';
    import ReactAccordion from 'react-accordion-new';
     
    class Example extends React.Component {
        constructor(props) {
            super(props);
        }
        render() {
            const elements = [
                {title:'test 1', content:'<h1>Heading 1</h1>'},
                {title:'test 2', content:'gaurav 2'}, 
                {title:'test 3', content:'gaurav'}
            ];
            return (
                <div>
                    <ReactAccordion elements={elements} />
                </div>
            )
        }
    }

    Options/Props

    The ReactAccordion component accepts the following props:

    {
      elements: [],//Required
      default: false //Optional
    }
    • Elements

      • Required Prop
      • Each entry refers to children of the accordion
      • Array of Objects with following keys:-
        • title : Text for the title of the child
        • content : Content string of the child
    • default

      • Optional Prop
      • Default to false
      • If true then first child is expanded by default

    Keywords

    none

    Install

    npm i react-accordion-new

    DownloadsWeekly Downloads

    3

    Version

    1.1.0

    License

    none

    Unpacked Size

    203 kB

    Total Files

    15

    Last publish

    Collaborators

    • gj2511