Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Demo
Usage
Install the package.
npm install --save react-accordion-comp
Import the package.
import Faq from 'react-accordion-comp';
Import styles to application. Import in a SCSS file.@import "~react-accordion-comp/dist/styles.css";
Or in JSX file.import "react-accordion-comp/dist/styles.css";
Code example:
import React, { useState } from 'react';
import Accordion from "react-accordion-comp";
function App() {
const [flag, setFlag] = useState(false);
return (
<div className="container">
<button onClick={()=>setFlag(!flag)}>
toggle content
</button>
<Accordion isOpen={flag}>
<div className="red">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
In sed tempor sem. Aenean vel turpis feugiat,
ultricies metus at, consequat velit. Curabitur est nibh,
varius in tellus nec, mattis pulvinar metus.
In maximus cursus lorem, nec laoreet velit eleifend vel.
Ut aliquet mauris tortor, sed egestas libero interdum vitae.
Fusce sed commodo purus, at tempus turpis.
</p>
</div>
</Accordion>
</div>
}