Switch
Switches are used to toggle between two states. They are commonly used to represent an on/off state.
Usage
import { Switch } from '@rothko-ui/ui';
- Example
- Code
Switch with label
With Icon
- Example
- Code
Disabled
- Example
- Code
With Kind
- Example
- Code
danger
info
primary
secondary
success
warning
Props
Name | Type | Default | Description |
---|---|---|---|
Name children | Type string | Default | Description The content of the switch |
Name className | Type React.ReactNode | Default | Description Adds a class to the switch |
Name onChange | Type (selected: boolean) => void | Default | Description Event handler for switch state change |
Name style | Type React.CSSProperties | Default | Description Inline style for the switch |
Name selected | Type boolean | Default | Description Specifies if the switch is selected or not |
Name onIcon | Type JSX.Element | Default | Description Icon to display when the switch is on |
Name offIcon | Type JSX.Element | Default | Description Icon to display when the switch is off |
Name disabled | Type boolean | Default | Description Disables the checkbox |