@shapla/react-checkbox
v1.0.0
Published
A custom checkbox for React that exactly work same way as native checkbox
Downloads
6
Readme
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
| Property | Type | Required | Default | Description
|---------------|-----------|-----------|-------------|-----------------------------------------------------------
| value
| String | no | yes
| The default value for the checkbox
| label
| String | no | | Checkbox label
| `disabled` | Boolean | **no** | `false` | If set `true`, Checkbox will be disabled to check.
| `checked` | Boolean | **no** | `false` | If set `true`, Checkbox will be checked.
| `onChange` | Function | **no** |
| A function that receives the Event. So you can get checked status event.target.checked