react-choose-group

0.1.0 • Public • Published

react-choose-group

Build radio/checkbox group in a short time.

demo

example(/example/example.js)

// import the Component
import { Group } from 'react-choose-group'
...
class YourComponent extends React.Component {
  // render the Component
  render () {
    return (
      <div>
        <Group
          type='radio'
          name='nameYourGroup'
          items={[1,2,3]}
          value={this.state.value}
          onChange={this.handleChange}
        />
      </div>
    )
  }
}

props

props description required
wrapperClassName classname of the wrapper
wrapperStyle style of the wrapper
itemClassName classname of every item
itemStyle style of every item
name name of the group Y
value as a controlled component, the value is the whole group's value Y
type type of items, is radio or checkbox Y
items items array Y
onChange function to handle the changing of the value Y
otherValues contains show(boolean) and separator, if show is true, an input(text) will be rendered to get other values, if type prop is checkbox, the input will be separated by the separator

Package Sidebar

Install

npm i react-choose-group

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

13.6 kB

Total Files

11

Last publish

Collaborators

  • noski