跳至内容

Switch - 开关 ​

更新日期

Demo ​

switch/demo.vue
brand 实色
accent 青色
small
disabled

当前:brand = true · accent = true

开关:行为与可访问性基于 reka-ui(role="switch"、键盘 Space / Enter、焦点管理),外观使用共享主题 token —— reka 管行为,我们管皮肤。

Props ​

属性说明类型默认值
v-model开关状态booleanfalse
varianton 态轨道brand | accentbrand
tone强调色,仅作用于 accentblue | sun | cyan | coral | pink | greenblue
size尺寸sm | mdmd
disabled禁用booleanfalse

tone 接受 blue | sun | cyan | coral | pink | green,默认 blue(晴空蓝),只在 accent 下生效。旧 aurora 值映射到 accent。同一流程中的同类状态使用同一种颜色。

通过 aria-label 或关联的 <label for> 提供用途名称。Space / Enter 切换状态,禁用时不响应操作。name、value 和 required 透传给 Reka UI,用于原生表单提交。