KSwitch
Use Switch to store contents.
Install
bash
pnpm add @ikun-ui/switch
pnpm add @ikun-ui/switch
bash
yarn add @ikun-ui/switch
yarn add @ikun-ui/switch
bash
npm install @ikun-ui/switch
npm install @ikun-ui/switch
Basic usage
Disabled switch
Use disabled
attribute to determine whether a switch is disabled.
Loading switch
Use disabled
attribute to determine whether a switch is loading.
Custom color switch
Custom switch value
Custom switch render
Switch Props
Name | Type | Default | Description |
---|---|---|---|
value | boolean | - | Binding value |
unCheckedValue | string / number / boolean | - | UnChecked state switch value |
checkedValue | string / number / boolean | false | Checked state switch value |
disabled | boolean | - | Disabled the switch |
loading | boolean | - | Loading state switch |
unCheckedColor | string | - | unChecked state switch color |
checkedColor | string | - | Checked state switch color |
cls | string | - | Additional class |
attrs | any | {} | Additional attributes |
Switch Events
Name | Description | Type |
---|---|---|
click | Triggered when the switch is clicked | (value: Event)=> void |
updateValue | Triggered when the value in the switch binding changes | (value: Event)=> void |
change | Triggered when the value in the switch binding changes | (value: Event)=> void |
Switch Slots
Name | Description |
---|---|
unCheckedRender | Customize content of the uncheked state switch |
checkedRender | Customize content of the cheked state switch |