0.0.1 • Published 8 years ago
RockSelect v0.0.1
RockSelect
Fancy and simple Select option component in react.js
Usage
Basic use
You can pass a simple list of string and specify the function that will trigger in every click on the options
// Import dependencies
import React from 'react'
import { render } from 'react-dom';
// Import RockSelect
import RockSelect from './components/RockSelect'
let foo = ()=>{
alert('FOO')
}
render(
<div>
<RockSelect options={['One', 'Two', 'three']} generalClick={foo} iconClass="icon-code" />
</div>, document.getElementById('app')
)
Object List items
Or you can pass a list of Objects with the configuration
const OPTIONS = [
{
value : 'Option 1',
click : theAction
}
]
Full Example
// Import dependencies
import React from 'react'
import { render } from 'react-dom';
// Import RockSelect
import RockSelect from './components/RockSelect'
let foo = ()=>{
alert('FOO')
}
let bar = ()=>{
alert('BAR')
}
let baz = ()=>{
alert('BAZ')
}
const OPTIONS = [
{
value : 'Option 1',
click : foo
},
{
value : 'Option 2',
click : bar
},
{
value : 'Option3',
click : baz
}
]
render(
<div>
<RockSelect options={OPTIONS} iconClass="icon-code" />
</div>, document.getElementById('app')
)
API
Select props
Development
npm install
npm start
0.0.1
8 years ago