0.1.3 • Published 11 years ago
react-checkbox v0.1.3
react-checkbox
React Checkbox
A React checkbox with support for the indeterminate state.
Install
$ npm i --save react-checkboxUsage
var Checkbox = require('react-checkbox')
var checked = null
React.render(
<Checkbox checked={checked} supportIntermediate={true} />,
document.body
)Props
checked: Boolean/Null - whether the checkbox should be checked or not. IfsupportIntermediateis true, thecheckedproperty can also have another value, which should equal toindeterminateValueprop (which defaults to null)supportIndeterminate: Boolean - whether the checkbox should support the indeterminate state. Defaults to false.indeterminateValue- the value forcheckedthat should render the checkbox as indeterminate. Defaults to nullstopPropagation: Boolean - whether to stopchangeevent propagation for the checkbox. Defaults to true.onChange: Function(value, event) - The function to call when the state of the checkbox changes. NOTE: Unlike<input type="checkbox" />, first param is the new value, and second param is the event object.defaultChecked- uncontrolled version ofcheckednextValue: Function(oldValue, props) - can be used to change the default value order (whensupportIndeterminateistrue). Default order is: (checked -> unchecked; unchecked -> indeterminate; indeterminate -> checked).
Other
If you want support for submitting the indeterminate value, and for specifying what to submit on each state, I suggest you take a look at react-check3