kodobe-react-dropdown
v2.0.5
Published
Kodobe React Dropdown
Downloads
8
Readme
Kodobe React Dropdown
This is a simple react dropdown package
Install
npm install kodobe-react-dropdown
or
yarn add kodobe-react-dropdown
Setup
import Dropdown from 'kodobe-react-dropdown';
Usage
import Dropdown from "kodobe-react-dropdown";
function App() {
return (
<div>
<h3>Here is how to use a dropdown</h3>
<br />
<Dropdown
options={[
{ title: "Text 1", value: "text1" },
{ title: "Text 2", value: "text2" },
{ title: "Text 3", value: "text3" },
]}
value={dropdown}
onChange={(e) => setDropdown(e)}
/>
<br />
<Dropdown
options={[
{ title: "Text 1", value: "text1" },
{ title: "Text 2", value: "text2" },
{ title: "Text 3", value: "text3" },
]}
title={"Menu"}
onChange={(e) => console.log(e)}
/>
</div>
);
}
Options
- options: List of object of structure {title:"title", value:"value"}
- title: dropdown title, use this if you want a static dropdown (string)
- value: dropdown value, use this if you want a dynamic dropdown (any)
- onChange: handle selection change in dropdown (function)
- style: style object
- className: string