Giter Site home page Giter Site logo

theinfosecguy / reactjs-custom-accordion Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 1.7 MB

A Complete Custom Accordion for ReactJS & NextJS

Home Page: https://www.npmjs.com/package/reactjs-custom-accordion

HTML 15.66% JavaScript 61.56% CSS 22.78%
accordion-component javascript npm-package react reactjs yarn hacktoberfest

reactjs-custom-accordion's Introduction

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'
    },
    {
      title: 'title 2',
      description: 'description 2'
    }
  ]

    return (
        <>
            <h4>๐Ÿš€ Default Accordion with sample data</h4>
            <Accordion data={sampleData} />
        </>
    )
}

export default Demo

Props

Name Type Default Optional
data Array of Objects undefined โŒ
PlusIcon Component AiOutlinePlusSquare โœ…
MinusIcon Component AiOutlineMinusSquare โœ…
headerBackground String #1a1a1a โœ…
footerBackground String #fff โœ…
plusIconSize String 25px โœ…
minusIconSize String 25px โœ…
plusIconColor String #fff โœ…
minusIconColor String #fff โœ…
accordionWidth String 80% โœ…
roundedBorders Boolean false โœ…
defaultOpen Boolean false โœ…
defaultOpenIndex Integer undefined โœ…
defaultAllOpen Boolean false โœ…
rootClass String undefined โœ…
cardClass String undefined โœ…
headerClass String undefined โœ…
footerClass String undefined โœ…

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

reactjs-custom-accordion's People

Contributors

theinfosecguy avatar tigv2 avatar

Watchers

 avatar

Forkers

tigv2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.