react-checkbox-handling

1.0.7 • Public • Published

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

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.

How it works

Package Sidebar

Install

npm i react-checkbox-handling

Weekly Downloads

1

Version

1.0.7

License

MIT

Unpacked Size

229 kB

Total Files

23

Last publish

Collaborators

  • simerdeep123