
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
@createnl/grouped-checkboxes
Advanced tools
An easy to use React Component to create a checkbox group with a checkbox to check all checkboxes and a checkbox to check none.
npm install --save @createnl/grouped-checkboxes
yarn add @createnl/grouped-checkboxes
Live examples: https://v5sww.csb.app/
Codesandbox: https://codesandbox.io/s/grouped-checkboxes-v5sww
import React from "react";
import { AllCheckerCheckbox, Checkbox, CheckboxGroup } from '@createnl/grouped-checkboxes';
const MyGroupedCheckboxes = (props) => {
const onCheckboxChange = (checkboxes) => {
console.log(checkboxes);
}
return (
<CheckboxGroup onChange={onCheckboxChange}>
<AllCheckerCheckbox />
<Checkbox value="option-1"/>
<Checkbox value="option-2" />
<Checkbox value="option-3" />
</CheckboxGroup>
);
};
Note that Checkbox and AllCheckerCheckbox must be inside a CheckboxGroup
AllCheckerCheckboxes and NoneCheckerCheckboxes inside a grouponChange callback on groupCheckbox you can do to an input component<CheckboxGroup defaultChecked> // Set defaultChecked to check all by default
<AllCheckerCheckbox checked/> // Error: You cant contol allCheckerCheckboxes individually (will check automatically if necessary)
<Checkbox value="anything" checked/> // Check individual checkboxes
</CheckboxGroup>
<CheckboxGroup defaultDisabled> // Set defaultDisabled to disable all by default
<AllCheckerCheckbox disabled/> // Disable allCheckerCheckbox, will still check if all checkboxes are checked
<Checkbox value="anything" disabled/> // Disable individual checkboxes
</CheckboxGroup>
import React from "react";
import { AllCheckerCheckbox, Checkbox, CheckboxGroup } from '@createnl/grouped-checkboxes';
const PermissionsFrom = (props) => {
const onCheckboxChange = (checkboxes) => {
console.log(checkboxes);
}
return (
<CheckboxGroup onChange={console.log}>
<label>
<Checkbox value="tos" />
Terms and Conditions
</label>
<label>
<Checkbox value="privacy-policy" />
Privacy Policy
</label>
<label>
<Checkbox value="advertisements" />
Advertisements
</label>
<label>
<AllCheckerCheckbox />
Agree to all
</label>
</CheckboxGroup>
);
};
The value of an onChange parameter looks like:
[
{
"checked": true,
"disabled": false,
"value": "tos"
},
{
"checked": true,
"disabled": false,
"value": "privacy-policy"
},
{
"checked": true,
"disabled": false,
"value": "advertisements"
}
]
All given props will be accessible.
If you need a checkbox that will check when nothing is checked you can use the NoneCheckerCheckbox. This checkbox can be clicked to uncheck everything else, but can't be unchecked to check everything else.
import React from "react";
import { NoneCheckerCheckbox, Checkbox, CheckboxGroup } from '@createnl/grouped-checkboxes';
const LunchDeclaration = (props) => {
const onCheckboxChange = (checkboxes) => {
console.log(checkboxes);
}
return (
<CheckboxGroup onChange={console.log}>
<h1>What did you eat for lunch?</h1>
<label>
<Checkbox value="pizza" />
Pizza
</label>
<label>
<Checkbox value="burger" />
Burger
</label>
<label>
<Checkbox value="fries" />
Fries
</label>
<label>
<NoneCheckerCheckbox />
Nothing
</label>
</CheckboxGroup>
);
};
The value of an onChange parameter looks like:
[
{
"checked": true,
"disabled": false,
"value": "pizza"
},
{
"checked": true,
"disabled": false,
"value": "burger"
},
{
"checked": true,
"disabled": false,
"value": "fries"
}
]
Note that the value of the NoneCheckerCheckbox will not be passed.
The Checkbox, AllCheckerCheckbox and NoneCheckerCheckboxes are nothing more than controlled native input elements and uses the forwardRef function for you to pass your ref to.
This enables you to control the DOM node and for example focus on the element.
import React from "react";
import { AllCheckerCheckbox, Checkbox, CheckboxGroup } from '@createnl/grouped-checkboxes';
const MyGroupedCheckboxes = (props) => {
const checkboxRef = React.createRef();
React.useEffect(() => {
if (checkboxRef.current) {
// Focus on the input element
checkboxRef.current.focus();
}
}, [checkboxRef])
return (
<CheckboxGroup>
<AllCheckerCheckbox />
<Checkbox ref={checkboxRef} value="option-1"/>
<Checkbox value="option-2" />
<Checkbox value="option-3" />
</CheckboxGroup>
);
};
FAQs
Grouped checkboxes with check-all checkboxes
We found that @createnl/grouped-checkboxes demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.