UNPKG

vcc-ui

Version:

VCC UI is a collection of React UI Components that can be used for developing front-end applications at Volvo Car Corporation.

31 lines (26 loc) 594 B
Toggle component is a styled wrapper to a checkbox / label pair. It accepts a "checked" prop, and a "onToggle" prop that is triggered by the checkbox onChange event. ### Default example ```jsx live=true () => { const [checked, setChecked] = React.useState(false) return <Toggle checked={checked} onChange={(e) => { setChecked(e.target.checked); }} /> } ``` ### Invalid state ```jsx live=true () => { const [checked, setChecked] = React.useState(false) return <Toggle isValid={false} checked={checked} onChange={(e) => { setChecked(e.target.checked); }} /> } ```