npm.io
1.0.4 • Published 3 years ago

react-dticheckboxlist

Licence
MIT
Version
1.0.4
Deps
0
Size
31 kB
Vulns
0
Weekly
0

react-dticheckboxlist

React list component with checkbox

NPM JavaScript Style Guide

Install

npm install --save react-dticheckboxlist

read before

Example code of how to use

import React, { Component } from 'react'
import DTICheckBoxList from 'react-dticheckboxlist'

class Example extends Component {
  const items =
    [{
      "id": "1",
      "label": "Cars",
      "disabled": false,
    },

    {
      "id": "2",
      "label": "Bicycles",
      "disabled": false,
    },

    {
      "id": "3",
      "label": "Trucks",
      "disabled": true,
    }
    ]

  const itemsSelecteds =
    [

      {
        "id": "2",
      },

      {
        "id": "3",
      }
    ]

    const [state, setState] = useState({
      items: items,
      itemsSelecteds: itemsSelecteds,
    });

    const handleChangeSelect = (prop) => {
      setState({
        ...state,
        itemsSelecteds: prop,
      });
    };

  render() {
    return
    <DTICheckBoxList
        items={state.items}
        selectedItems={state.itemsSelecteds}
        showSelectedAll={true}
        labelSelectedAll={"Select All"}
        checkBoxSelectedAllColor={'#3f51b5'}
        checkBoxSelectedAllLabelColor={'#3f51b5'}
        checkBoxColor={'#3f51b5'}
        checkBoxLabelColor={'#3f51b5'}
        backgroundColorCheckBoxSelected={'#f7f7f7'}
        onChange={handleChangeSelect}
        />
  }
}

Color Scheme

read before

## License

MIT lucianodoria