🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

react-checkbox-group

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-checkbox-group - npm Package Compare versions

Comparing version

to
0.1.4

16

package.json
{
"name": "react-checkbox-group",
"version": "0.1.3",
"version": "0.1.4",
"description": "Sensible checkbox groups manipulation for DOM.",

@@ -21,6 +21,3 @@ "main": "react-checkbox-group.jsx",

],
"author": {
"name": "Ziad Saab",
"email": "ziad.saab@gmail.com"
},
"author": "Ziad Saab <ziad.saab@gmail.com>",
"license": "MIT",

@@ -33,10 +30,3 @@ "bugs": {

"react": "~0.11.1"
},
"readme": "# [React](http://facebook.github.io/react/)-checkbox-group\n## Heavily inspired from https://github.com/chenglou/react-radio-group\n\nThis is your average checkbox group:\n\n```html\n<form>\n <input type=\"checkbox\" name=\"fruit\" value=\"apple\" />Apple\n <input type=\"checkbox\" name=\"fruit\" value=\"orange\" />Orange\n <input type=\"checkbox\" name=\"fruit\" value=\"watermelon\" />Watermelon\n</form>\n```\n\nRepetitive, hard to manipulate and easily desynchronized.\nLift up `name`, give the group an initial checked values array, and optionally remove the form tag:\n\n```html\n<CheckboxGroup name=\"fruit\" value={['apple','watermelon']}>\n <input type=\"checkbox\" value=\"apple\" />Apple\n <input type=\"checkbox\" value=\"orange\" />Orange\n <input type=\"checkbox\" value=\"watermelon\" />Watermelon\n</CheckboxGroup>\n```\n\nListen for changes, get the new value as intuitively as possible:\n\n```html\n<CheckboxGroup name=\"fruit\" value={['apple','watermelon']} ref=\"fruitsGroup\" onChange={this.handleChange}>\n// further...\n\nthis.refs.fruitsGroup.getCheckedValues(); // => whatever's currently checked\n```\n\nThat's it for the API! See below for a complete example.\n\n## Install\n\n```sh\nbower install react-checkbox-group\nor\nnpm install react-checkbox-group\n```\n\nSimply require it to use it:\n\n```javascript\nvar CheckboxGroup = require('react-checkbox-group');\n```\n\n## Example\n\n```html\n/**\n* @jsx React.DOM\n*/\nvar Demo = React.createClass({\n getInitialState: function() {\n return {value: ['apple','watermelon']};\n },\n\n componentDidMount: function() {\n // Add orange and remove watermelon after 1 second\n setTimeout(function() {\n this.setState({value: ['apple','orange']});\n }.bind(this), 1000);\n },\n\n render: function() {\n // the checkboxes can be arbitrarily deep. They will always be fetched and\n // attached the `name` attribute correctly. `value` is optional\n return (\n <CheckboxGroup\n name=\"fruits\"\n value={this.state.value}\n ref=\"fruitsGroup\"\n onChange={this.handleChange}\n >\n <div>\n <label>\n <input type=\"checkbox\" value=\"apple\"/>Apple\n </label>\n <label>\n <input type=\"checkbox\" value=\"orange\"/>Orange\n </label>\n <label>\n <input type=\"checkbox\" value=\"watermelon\"/>Watermelon\n </label>\n </div>\n </CheckboxGroup>\n );\n },\n\n handleChange: function() {\n // will return the currently selected checkbox values as an array, possibly empty\n var selectedFruits = this.refs.fruitsGroup.getCheckedValues();\n }\n});\n\nReact.renderComponent(<Demo/>, document.body);\n```\n\n## License\n\nMIT.\n",
"readmeFilename": "README.md",
"_id": "react-checkbox-group@0.1.2",
"dist": {
"shasum": "4eaec573506dad830654874a47d31922f0afdc87"
},
"_from": "react-checkbox-group"
}
}

Sorry, the diff of this file is not supported yet