Switch
Switch
Switch selector for when switching between two states, such as on and off, is required.
Usage
import { Switch } from '@antv/gui';SwitchOptions
| Property | Description | Type | Default |
|---|---|---|---|
| x | The x coordinate of the starting point | number | - |
| y | The y coordinate of the starting point | number | - |
| size | Switch the size | number | 22 |
| spacing | Switch background spacing | number | 2 |
| textSpacing | Left-right spacing of text background | number | 8 |
| style | Custom button styles | StyleAttr | - |
| disabled | Do not choose | boolean | false |
| checked | Specifies whether it is currently selected | boolean | - |
| defaultChecked | Initial check or not | boolean | true |
| checkedChildren | The content when selected | TagCfg | - |
| unCheckedChildren | The content when not selected | TagCfg | - |
| onChange | Callback function when change | function(checked: boolean) | - |
| onClick | Callback function when clicked | function(e:Event, checked: boolean) | - |