Socket
Socket
Sign inDemoInstall

react-virtualized-checkbox

Package Overview
Dependencies
15
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-virtualized-checkbox

Checkbox group component with virtualization for large number of items


Version published
Weekly downloads
146
decreased by-36.24%
Maintainers
1
Install size
3.82 MB
Created
Weekly downloads
 

Readme

Source

React Virtualized Checkbox

Demo available here: http://emilebres.github.io/react-virtualized-checkbox/

react-virtualized-checkbox-demo

Getting started

Install react-virtualized-checkbox using npm.

npm install react-virtualized-checkbox --save

yarn add react-virtualized-checkbox

And in your code:

import VirtualizedCheckbox from 'react-virtualized-checkbox'

Simple Example

You pass react-virtualized-checkbox an array of items. Here's a simple example:

import React, { Component } from 'react'
import VirtualizedCheckbox from 'react-virtualized-checkbox'

class MyCheckbox extends Component {
  constructor (props) {
    super(props)

    this.state = {}
  }

  render () {
    const items = [
      { label: "One", value: 1, checked: true},
      { label: "Two", value: 2, checked: true},
      { label: "Three", value: 3, checked: true}
      // And so on...
    ]

    return (
      <VirtualizedCheckbox
        items={items}
        onOk={(checkedItems) => this.setState({ checkedItems })}
        onCancel={ () => this.setState({ checkedItems: [] })}
      />
    )
  }
}

React Virtualized Checkbox Props

PropertyTypeDescription
itemsPropTypes.arrayItems to choose from; can be an array of strings or an array of objects.
onOkPropTypes.funcCallback called when the Ok button is clicked; takes an array of the selected items, a boolean if all items are selected and the text filter as arguments.
onCancelPropTypes.funcCallback called when the Cancel button is clicked.
onChangePropTypes.funcCallback called when a checkbox is clicked. If a normal checkbox is clicked, will return the item. If the (Select all) checkbox is clicked, will return an array of all filtered items.
hasFilterBoxPropTypes.boolIf the text filter box is displayed; defaults to true
hasOkButtonPropTypes.boolIf the Ok button is displayed; defaults to true
hasCancelButtonPropTypes.boolIf the Cancel button is displayed; defaults to true
labelKeyPropTypes.stringLabel key; defaults to 'label'.
rowHeightPropTypes.numberRow height; defaults to 30 pixels.
heightPropTypes.numberComponent height; If not set, will get from the parent.
widthPropTypes.numberComponent width; If not set, will get from the parent.

FAQs

Last updated on 21 Aug 2017

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc