inferno-dropdown
v0.9.3
Published
Inferno dropdown component
Downloads
4
Maintainers
Readme
inferno-dropdown
This is a fork of react-dropdown for Inferno
Simple Dropdown component for Inferno.
Why
- The default HTML select element is hard to style
- And sometime we also want grouped menus
Installation
$ npm install inferno-dropdown --save
Usage
Flat Array options
const options = [
'one', 'two', 'three'
]
Object Array options
const options = [
{ value: 'one', label: 'One' },
{ value: 'two', label: 'Two' },
{
type: 'group', name: 'group1', items: [
{ value: 'three', label: 'Three' },
{ value: 'four', label: 'Four' }
]
},
{
type: 'group', name: 'group2', items: [
{ value: 'five', label: 'Five' },
{ value: 'six', label: 'Six' }
]
}
]
Monut
import Dropdown from 'inferno-dropdown'
const defaultOption = options[0]
<Dropdown options={options} onChange={this._onSelect} value={defaultOption} placeholder="Select an option" />
Check more examples in the example folder.
Run example
$ npm start
License
MIT | Build for CSViz project @Wiredcraft