0.1.0 • Published 5 years ago

react-choose-group v0.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

react-choose-group

npm.io

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

propsdescriptionrequired
wrapperClassNameclassname of the wrapper
wrapperStylestyle of the wrapper
itemClassNameclassname of every item
itemStylestyle of every item
namename of the groupY
valueas a controlled component, the value is the whole group's valueY
typetype of items, is radio or checkboxY
itemsitems arrayY
onChangefunction to handle the changing of the valueY
otherValuescontains 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