react-dropdown-wrapper
v0.0.4
Published
Convenient, simple, quick dropdown menu wrapper for accessibility.
Downloads
7
Maintainers
Readme
react-dropdown-wrapper
Convenient, simple, quick dropdown menu wrapper for accessibility.
Demo
Install
npm install react-dropdown-wrapper
or
yarn add react-dropdown-wrapper
Import
import DropdownWrapper from "react-dropdown-wrapper";
Usage
<DropdownWrapper
closeOnEsc
onStateChange={console.log}
wrapperProps={{
className: "bg-primary"
}}
>
{({ changeStatus, isShow }) => (
<div>
<button onClick={() => changeStatus(!isShow)}>
Dropdown Toggle Button
</button>
{isShow && <div>Dropdown Content</div>}
</div>
)}
</DropdownWrapper>
Props
|Props Name|Type|Default Value| |--|--|--| |closeOnEsc|bool|false| |closeOnOutsideClick|bool|true| |wrapperProps|object|{}| |onStateChange|function|null| |children|function|null| |initialStatus|bool|false|