Toggle
Used to select between two values.
Usage
import { Toggle } from 'rsuite';
Examples
Default
Size
The size
property sets the switch size, and the value includes: lg
、md
、sm
.
Text and icon
Can be set by the checkedchildren
, uncheckedchildren
two properties, respectively, the display of the toggle state.
Disabled
Props
<Toggle>
Property | Type (Default) |
Description |
---|---|---|
checked | boolean | Checked(Controlled) |
checkedChildren | React.Node | Checked display content |
classPrefix | string 'toggle' |
The prefix of the component CSS class |
defaultChecked | boolean | Default checked |
disabled | boolean | Disabled |
onChange | (checked: boolean, event: SyntheticEvent) => void | Callback function when state changes |
size | enum: 'lg', 'md', 'sm' | Toggle size |
unCheckedChildren | React.Node | Unselected display content |