切换主题
YSwitch
适用范围:Legacy Admin Kit / Schema 与旧
admin-vue。新admin-nuxtui的开发入口见管理端 Nuxt UI 指南。
定位 / Owner
YSwitch 是即时布尔设置 facade,保持 v-model 和 disabled contract,名称由宿主通过 aria-label 或 aria-labelledby 提供。
什么时候使用
用于用户可立即理解的开启/关闭设置,例如减少动画或是否发布。
不什么时候使用
需要用户提交整个表单后才生效、或包含不确定态时使用 YCheckbox。
Public API
v-model<boolean>;prop:disabled;原生 ARIA attrs 透传到 switch control。
Composition
设置页优先放入 YSettingRow,由 scoped slot 的 labelId / describedBy 建立可访问关系。
Anti-pattern
不要只靠相邻视觉文字命名 switch,也不要绕过 facade 直接消费 Reka primitive。
Production Example
Preference Drawer、Chatwoot 设置与 Product Editor 直接消费它。
Live Workbench
/frontend-module-demo/component-workbench/switch
Verification / Source
packages/yoyo-admin/admin-kit/src/ui/components/switch/YSwitch.vue- Admin Kit facade tests 与 Preference Drawer consumer