npm install --save canducci-switch
import React, { Component } from 'react'
import CanducciSwitch, { Size } from 'canducci-switch'
class Example extends Component {
const [value, setValue] = useState<boolean>(true)
render() {
return (
<div>
<div>
<CanducciSwitch
defaultChecked={value}
onChange={() => setValue(!value)}
size={Size.Medium}
/>
</div>
<div>
<CanducciSwitch
defaultChecked={value}
onChange={() => setValue(!value)}
size={Size.Medium}
round
/>
</div>
</div>
)
}
}
Prop | Type | Default |
---|---|---|
round | bool | false |
size | enum | medium |
backgroundColorOn | string | '#2196f3' |
backgroundColorOff | string | '#cccccc' |
cicleColor | string | '#ffffff' |