2.0.2 • Published 5 years ago

@opuscapita/react-checkbox v2.0.2

Weekly downloads
1,760
License
MIT
Repository
github
Last release
5 years ago

react-checkbox

Description

OpusCapita styled checkbox component

Installation

npm install @opuscapita/react-checkbox

Demo

View the DEMO

Builds

UMD

The default build with compiled styles in the .js file. Also minified version available in the lib/umd directory.

CommonJS/ES Module

You need to configure your module loader to use cjs or es fields of the package.json to use these module types. Also you need to configure sass loader, since all the styles are in sass format.

API

Prop nameTypeDefaultDescription
onChangefunctionrequiredCallback function for checkbox
onFocusfunction() => {}onFocus callback function for checkbox
onBlurfunction() => {}onBlur callback function for checkbox
checkedbooleanfalseIs checked or not
classNamestringAdditional class for component
disabledbooleanfalseIs disabled
idstringID attribute. Resulting element ID will be ${id}-checkbox
namestringName attribute
valuestringValue attribute
labelstring or nodeCheckbox label
tabIndexstring0tabIndex

Code example

import React from 'react';
import Checkbox from '@opuscapita/react-checkbox';

export default class ReactView extends React.Component {
  render() {
    return (
      <Checkbox
        onChange={this.onChange}
      />
    );
  }
}