1.0.7 • Published 4 years ago

react-checkbox-handling v1.0.7

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

react-checkbox-handling

A HOC to manage checkboxes state

Demo

Edit ReactCheckbox

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

OptionTypeDefault ValueDescription
checkboxKeystring'CHECK_KEY'To provide custom key to check
isShiftRequiredbooleanfalseIf 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.

How it works