3.0.0 • Published 2 years ago

react-three-state-checkbox v3.0.0

Weekly downloads
1,501
License
MIT
Repository
github
Last release
2 years ago

react-three-state-checkbox

npm Codecov GitHub last commit license

React component for checkbox that supports the indeterminate state conveniently. This component is TypeScript compatible.

Installation

The most straightforward way to use this component in your project is to either use npm or yarn.

# npm
npm i --save react-three-state-checkbox

# yarn
yarn add react-three-state-checkbox

Import in your project using the following.

import Checkbox from 'react-three-state-checkbox'

Usage

This component is a wrapper around the default HTML input element.

import React, { Component } from 'react';
import Checkbox from 'react-three-state-checkbox';

export default class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
      checked: false,
      indeterminate: false
    };
  }

  handleChange = () => { ... };

  render() {
    const { checked, indeterminate } = this.state;
    return (
      <Checkbox
        checked={checked}
        indeterminate={indeterminate}
        onChange={this.handleChange}
      />
    );
  }
}

Props

PropsTypeDescription
classNamestring?Classname to be applied to the input element.
styleReact.CSSProperties?Inline styles to be passed to input element.
checkedbooleanBoolean value of checkbox's checked state.
indeterminateboolean?Boolean value of checkbox's indeterminate state.
disabledboolean?Boolean value of checkbox's disabled state.
onChange() => {}?Function called when value of checkbox changes.

Styling

There are no additional dom wrappers around the input component. The className prop styles the input element directly.

License

MIT Licensed. Copyright (c) Jonathan Chiam 2019.

3.0.0

2 years ago

2.0.0

2 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

5 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.2

6 years ago

0.0.3

6 years ago

0.0.1-beta2

6 years ago

0.0.1-beta1

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago