Skip to content
On this page

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 ​

NameTypeDefaultDescription
valueboolean-Binding value
unCheckedValuestring / number / boolean-UnChecked state switch value
checkedValuestring / number / booleanfalseChecked state switch value
disabledboolean-Disabled the switch
loadingboolean-Loading state switch
unCheckedColorstring-unChecked state switch color
checkedColorstring-Checked state switch color
clsstring-Additional class
attrsany{}Additional attributes

Switch Events ​

NameDescriptionType
clickTriggered when the switch is clicked(value: Event)=> void
updateValueTriggered when the value in the switch binding changes(value: Event)=> void
changeTriggered when the value in the switch binding changes(value: Event)=> void

Switch Slots ​

NameDescription
unCheckedRenderCustomize content of the uncheked state switch
checkedRenderCustomize content of the cheked state switch

MIT Licensed