select-dropdown-react
v1.1.0
Published
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
Downloads
18
Maintainers
Readme
select-dropdown-react
Installation
// with npm
$ npm install select-dropdown-react --save
// with yarn
$ yarn add select-dropdown-react
Usage
This is the basic usage of react-dropdown
import { Dropdown } from 'select-dropdown-react'
const options = [
{ value: "green", label: "Green", },
{ value: "blue", label: "Blue" },
{ value: "red", label: "Red" },
{ value: "orange", label: "Orange" },
];
<Dropdown
isSearchable
placeHolder="Select..."
options={options}
onChange={(value) => console.log(value)}
/>
```
For Multi-Level Dropdown
```JavaScript
const options = [
{ value: "green", label: "Green", },
{ value: "blue", label: "Blue" },
{ value: "red", label: "Red" },
{ value: "yellow", label: "Yellow",level1:[{value:"child",label:"Child001"},{value:"child2",label:"Child0031"},{value:"child",label:"Child002"}] },
{ value: "orange", label: "Orange" },
{ value: "pink", label: "Pink" },
];
Multi-Select the Dropdown
Just pass a MultiSelect value to the Dropdown.
<Dropdown
isSearchable
MultiSelect
placeHolder="Select..."
options={options}
onChange={(value) => console.log(value)}
/>
Sidebar(Vertical-align of levels)
Just pass a MultiSelect value to the Dropdown.
<Dropdown
Sidebar
placeHolder="Select..."
options={options}
onChange={(value) => console.log(value)}
/>
Disable field
<Dropdown disabled />;
Clear Input
<Dropdown clearInput />;