fyndiq-component-checkbox
v2.3.4
Published
[Preview](http://developers.fyndiq.com/fyndiq-ui/?selectedKind=Checkbox&selectedStory=default)
Downloads
7
Keywords
Readme
fyndiq-component-checkbox
A checkbox component for Fyndiq
Installation
The component can be installed through NPM:
npm i -S fyndiq-component-checkbox
Usage
import React from 'react'
import Checkbox from 'fyndiq-component-checkbox'
// Basic usage
<Checkbox onToggle={newStatus => console.log(newStatus)} />
// Control the checked state
<Checkbox checked />
// Change the color of the checkmark
<Checkbox color="red" />
// Disabled checkbox
<Checkbox disabled />
API
The component Checkbox
has the following customizable props:
| Name | Type | Description | Default value |
|---|---|---|---|
| onToggle | Function | The handler called whenever the checkbox changes state. The argument passed is the new state of the checkbox. | noop => noop
| className | String | Optional class for advanced styling | ''
|
| color | String | The color of the checkmark | light grey |
| checked | Boolean | Activates the checkbox. | false
|
| disabled | Boolean | Disables the checkbox. | false
|
| indeterminate | Boolean | Activates the indeterminate mode. Usefull when the checkbox has children checkboxes. See CSS-tricks | false
|