1.0.0 • Published 3 years ago

@shapla/react-checkbox v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Shapla React Checkbox

A custom checkbox for React that exactly work same way as native checkbox

Table of contents

Installation

npm install --save @shapla/react-checkbox

Usage

Styles

with Sass:

import '@shapla/react-checkbox/src/index.scss';

with CSS:

import '@shapla/react-checkbox/dist/checkbox.css';

Javascript Instantiation

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

class MyApp extends React.Component {
  render() {
    return (
      <Checkbox name="_acceptance" value='yes' label="You must accept our terms and conditions." checked={true}/>
    );
  }
}

Props

PropertyTypeRequiredDefaultDescription
valueStringnoyesThe default value for the checkbox
labelStringno | Checkbox label
disabledBooleannofalseIf set true, Checkbox will be disabled to check.
checkedBooleannofalseIf set true, Checkbox will be checked.
onChangeFunctionno | A function that receives the Event. So you can get checked status event.target.checked