# UGThemeController 主题控制器

> 适配器：Vue；状态：available；slug：`theme-controller`。

低层单项控件：将原生单选或复选控件映射到一个 UG Theme data attribute。

## 适用场景

- 让原生 radio/checkbox 修改 UG Theme 的 mode、preset、density、radius、contrast 或 accent。

## 不适用场景

- 只想给局部区域固定主题时直接使用 ThemeScope/ThemeProvider；业务主题不是 UG data attribute 时不要使用。

## 公开入口

- 包入口：`@ug666/ui-vue/components`
- 公开成员：`UGThemeController`
- 交互文档：[https://ui.ug666.top/vue/components/theme-controller](https://ui.ug666.top/vue/components/theme-controller)

```vue
import { UGThemeController } from '@ug666/ui-vue/components'
```

## 使用规则

- 受控 radio 组由业务维护唯一 checked；持久化和服务端同步留在业务层；target 默认是 documentElement，也可传局部元素。
- 双向值优先使用组件声明的 v-model 参数。
- 事件、插槽和 expose 以 Vue 类型为准，不照搬 React 回调名。
- 只通过公开 Props、事件、插槽、class/className 和语义 Token 扩展。

## 相关候选

- [config-provider](https://ui.ug666.top/ai/vue/components/config-provider.md)
- [radio](https://ui.ug666.top/ai/vue/components/radio.md)
- [switch](https://ui.ug666.top/ai/vue/components/switch.md)

## 生成前检查

- 当前适配器是否真实提供该组件。
- 导入路径、组件名和 API 是否存在于当前版本类型声明。
- 是否覆盖长文本、窄容器、键盘、焦点、disabled、loading 和错误状态。
