@materialr/switch
React Material switch implementation
$ npm install --save @materialr/switch
A full demo is available on the MaterialR website showcasing all variants.
import Switch from '@materialr/switch';
Props
Prop | Type | Required | Default | Description |
---|---|---|---|---|
checked |
bool | No | false | Whether the switch is on |
className |
string | No | undefined | Additional classNames to add |
disabled |
bool | No | false | Whether the switch is disabled |
id |
string | No | uuidv1() |
The id attribute of the element |
label |
string | Yes | N/A | The label to render for the switch |
name |
string | No | undefined | The element's name attribute |
onBlur |
func | No | undefined | The blur event handler |
onChange |
func | No | undefined | The change event handler |
onDragStart |
func | No | undefined | The dragstart event handler |
onDrop |
func | No | undefined | The drop event handler |
onFocus |
func | No | undefined | The focus event handler |