1.0.0 • Published 2 years ago

reactjs-custom-accordion v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Custom React Accordion for ReactJS & NextJS

🚀 A Complete Custom Accordion for ReactJS & NextJS 🚀

NPM JavaScript Style Guide NPM Downloads Bundle Size

Live Demo

Demo Link

Install

Using NPM:

npm install reactjs-custom-accordion

Using Yarn:

yarn add reactjs-custom-accordion

Usage

import React from 'react'
import { Accordion } from 'reactjs-custom-accordion'

function Demo() {
  
  const sampleData = [
    {
      title: 'title 1'
      description: 'description 1'
    }
  ]

    return (
        <>
            <h4>🚀 Default</h4>
            <Accordion data={sampleData} />
        </>
    )
}

export default Demo

Props

NameTypeDefaultOptional
dataArray of Objectsundefined
PlusIconComponentAiOutlinePlusSquare
MinusIconComponentAiOutlineMinusSquare
headerBackgroundString#1a1a1a
footerBackgroundString#fff
plusIconSizeString25px
minusIconSizeString25px
plusIconColorString#fff
minusIconColorString#fff
accordionWidthString80%
roundedBordersBooleanfalse
defaultOpenBooleanfalse
defaultOpenIndexIntegerundefined
defaultAllOpenBooleanfalse
rootClassStringundefined
cardClassStringundefined
headerClassStringundefined
footerClassStringundefined

Usage with Props

import React from 'react'
import { Accordion } from 'reactjs-custom-accordion'
import {FaBed} from "react-icons/fa"
import sampleData from '../../Data' 

function Demo() {
    return (
        <>
            <Accordion
                data={sampleData} 
                defaultOpen={true} // Set to true if need to open any Accordion by default
                defaultOpenIndex={0} // Index of Accordion to open by default
                roundedBorders={true} // Set to true if need rounded borders
                PlusIcon={FaBed} // Icons from React Icons
                headerBackground="#444" // Color code, RGB Code or Color Name
                plusIconSize="30px" // Size of Icon
                accordionWidth="90%" // Width of Accordion with regard to Root Container
                rootClass="custom-root-class" // Custom class of Root Container
                cardClass="custom-card-class" // Custom class of Accordion Card
                headerClass="custom-header-class" // Custom class of Header
                footerClass="custom-footer-class" // Custom class of Footer
            />
        </>
    )
}

export default Demo

Checkout Example App in /example Directory

License

MIT © theinfosecguy

1.0.0

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.8

2 years ago

0.1.9

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago