Basic Components
Switch
Switch is used to toggle a single setting on or off, typically used to represent two opposite states, such as on/off.
Switch
Switch is used to toggle a single setting on or off, typically used to represent two opposite states, such as on/off.
themeDocs.examples
Basic Usage
Basic usage of the switch, for toggling boolean values. By default, clicking toggles the switch state.
300px
Disabled State
Disabled switches cannot be clicked and are typically used to indicate that a feature is unavailable or you don't have permission to operate it.
300px
themeDocs.api
themeDocs.props
Property | Basic component module for translation keys shared across all component documentation pages | Type | Default |
---|---|---|---|
modelValue | 开关的值,使用v-model双向绑定 | Boolean | false |
disabled | 是否禁用开关 | Boolean | false |
label | 开关的无障碍标签,用于屏幕阅读器 | String | 'Switch' |
themeDocs.events
Event | Basic component module for translation keys shared across all component documentation pages | Parameters |
---|---|---|
update:modelValue | 开关状态改变时触发,返回新值 | No parameters |
change | 开关状态改变时触发,返回新值 | No parameters |
Design Empowers, Innovation Unlimited