react-checkbox-handling
v1.0.7
Published
To handle checkbox data with or without using shift key
Downloads
4
Maintainers
Readme
react-checkbox-handling
A HOC to manage checkboxes state
Demo
Or see it on Github Page.
Installation
npm install react-checkbox-handling
or
yarn add react-checkbox-handling
Usage
1 . Import handleCheckbox
import handleCheckbox from 'react-checkbox-handling';
2 . Pass your component to handleCheckbox
export default handleCheckbox(ComponentName,Configuration(optional))
Configuration Options
| Option | Type | Default Value | Description | :-------------------- | :-------------------- | :------------ | :---------------------- | | checkboxKey | string | 'CHECK_KEY' | To provide custom key to check | isShiftRequired | boolean | false | If shift key support is required or not
Props Provided
These are all of the available props (and their default values) provided by hoc.
{
checkedItems: [], //Checked values
checkAll: () => void, //To check all the values
uncheckAll: () => void, //To uncheck all the values
updateCheckedItems: (checkedItem : Array<Object> | Array<string> | Object | string , addItems: boolean = false ) => void // To update the checked item array , addItems value will be used when array is passed in checkedItem
updateTotalItems: (totalItems: Array<Object> | Array<string>) => void //To update the total list of items
}
Example
Copy the example folder in your project and run it.