You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

react-virtualized-checkbox

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-virtualized-checkbox

Checkbox group component with virtualization for large number of options

1.0.1
npmnpm
Version published
Weekly downloads
104
166.67%
Maintainers
1
Weekly downloads
 
Created
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

ES6, CommonJS, and UMD builds are available with each distribution. For example:

import VirtualizedCheckbox from 'react-virtualized-checkbox'

Alternately you can load a global-friendly UMD build:

<script src="path-to-react-virtualized-checkbox/dist/umd/react-virtualized-checkbox.js"></script>

Simple Example

You pass react-virtualized-checkbox an array of options. 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 options = [
      { label: "One", value: 1 },
      { label: "Two", value: 2 },
      { label: "Three", value: 3 }
      // And so on...
    ]

    return (
      <VirtualizedCheckbox
        options={options}
        onOK={(checkedOptions) => this.setState({ checkedOptions })}
        onCancel={ () => this.setState({ checkedOptions: [] })}
      />
    )
  }
}

React Virtualized Checkbox Props

PropertyTypeDescription
optionsPropTypes.arrayOptions to choose from; can be an array of strings or an array of objects.
onOkPropTypes.funcCallback called when the Ok button is clicked; takes the selected option labels as arguments.
onCancelPropTypes.funcCallback called when the Cancel is clicked.

The additional parameters introduced by react-virtualized-checkbox are optional. They are:

PropertyTypeDescription
maxHeightPropTypes.numberMax height of options menu; defaults to 300 pixels.
optionHeightPropTypes.numberOption height; defaults to 30 pixels.
labelKeyPropTypes.stringLabel key; defaults to 'label'.
valueKeyPropTypes.stringValue key; defaults to 'value'.

Keywords

react

FAQs

Package last updated on 08 Jun 2016

Did you know?

Socket

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