docs(appearance): document preference hooks

This commit is contained in:
Maofeng
2026-09-29 22:12:56 +08:00
parent 642cb71b93
commit e34675a931
4 changed files with 68 additions and 2 deletions
@@ -57,7 +57,18 @@ toc:
## 状态连接层 {#connected-layer}
`AppearanceSettings` 是原子组件与共享 `PreferencesProvider` 之间的默认连接层。自定义界面可以直接使用 `@workspace/preferences` 的 `usePreference` 读取单个字段,而不必复用默认布局。
`AppearanceSettings` 是原子组件与共享 `PreferencesProvider` 之间的默认连接层。自定义界面可以使用 Appearance 提供的 `useThemeMode`、`useThemeConfig`、`useResolvedTheme` 等 hooks,而不必知道共享偏好的字符串键,也不必复用默认布局。
```tsx
const [themeConfig, setThemeConfig] = useThemeConfig()
const resolvedTheme = useResolvedTheme()
<ThemeConfigCard
config={themeConfig}
onConfigChange={setThemeConfig}
scheme={resolvedTheme}
/>
```
## 在线预览 {#live-preview}