react-hooks-accordion
v1.1.0
Published
A simple accordion react component.
Downloads
6
Maintainers
Readme
react-hooks-accordion
A simple accordion made out of react hooks.
table-of-contents
Installation:
npm install react-hooks-accordion
yarn add react-hooks-accordion
Dependency:
>= [email protected]
>= [email protected]
Usage:
import React from "react";
import { render } from "react-dom";
import Accordion from "react-hooks-accordion";
render(
<Accordion
className="accordion"
title="Accordion Title"
onToggle={visible => {
alert(`Accordion is ${visible}`);
}}
>
<ul>
<li>
<span>Hello</span>
</li>
<li>
<span>How are you</span>
</li>
<li>
<span>I am good</span>
</li>
</ul>
</Accordion>,
document.getElementById("root")
);
Props:
Title: > Type: string
Children: > Type: any
className: > Type: string (optional)
onToggle: Callback on toggling the accordion (optional)
Type: function
Argument: boolean
Development:
npm start
Build:
npm run build