UNPKG

select-dropdown-react

Version:

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

89 lines (66 loc) 1.68 kB
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 ```Javascript 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. ```JavaScript <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. ```JavaScript <Dropdown Sidebar placeHolder="Select..." options={options} onChange={(value) => console.log(value)} /> ``` **Disable field** ```JavaScript <Dropdown disabled />; ``` **Clear Input** ```JavaScript <Dropdown clearInput />; ```