1.1.5 • Published 2 years ago

responsive-react-accordion v1.1.5

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

Responsive React Accordion

Installation

# npm install
npm i responsive-react-accordion
# yarn install
yarn add responsive-react-accordion

Demo

2021-12-14_02-33-40_AdobeCreativeCloudExpress_AdobeCreativeCloudExpress

Usage

// import the npm package
import { Accordion } from 'responsive-react-accordion';

Simple example

// Simple example
<Accordion 
  title='This is an awesome react accordion' 
  content='This is hell awesome 🔥' 
/>

Render prop example

// Props example
<Accordion 
  title='This is an awesome react accordion' 
  content='This is hell awesome 🔥' 
  openIcon={Opening Icon}
  closeIcon={Closing Icon}
  spacing={10} 
/>

Props

PropTypeDescription
titleStringThe title of the accordion.
contentStringThe content inside the accordion.
spacingNumberThe spacing between the accordion.
openIconanyThe customizable opening icon.
closeIconanyThe customizable closing icon.

Complete example

import { Avatar } from 'user-profile-avatar'

function App() {
  return (
    <div className="App">
      <Avatar 
        src='Enter your image Link'
        alt='profile'
        size={80}
      />
    </div>
  );
}

export default App;

CSS Styling access to containers

/* .accordion-container is the parent container */
.accordion-container {
  /* enter your css */
}

/* .accordion this is a extra wrapper for the main component */
.accordion {
  /* here you can add a univeral bg color and style the remainig component according */
  /* example */
  background-color: #0d152d;
  border: 2px solid white;
  border-radius: 12px;
  color: white;
}

/* .accordion-title this is where the title of accordion is kept */
.accordion-title {
  /* style the title of the accordion  */
  /* example */
  font-size: 20px;
  font-weight: 600;
}

/* .accordion-collapsible the collapsible content */
.accordion-collapsible {
  /* style the content of the accordion */
  /* example */
  background-color: white;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  color: black;
}

/* .accordion-icon  the icons in the .accordion-title element */
.accordion-icon  {
  /* to set the size of the icon */
  /* example */
  width: 20px;
}