Files
ui/docs/getting-started/theming.md
2025-12-27 18:25:15 +03:00

42 lines
1.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Theming (theme/platform/skin)
Tria UI использует три измерения конфигурации:
- `theme`: `light | dark`
- `platform`: `web | vk | tg`
- `skin`: `web | ios | android`
Комбинация управляет *CSS пресетами* и компонентными токенами.
## UIProvider
```tsx
import { UIProvider } from "@tria/ui";
<UIProvider config={{ theme: "dark", platform: "vk", skin: "ios" }}>
...
</UIProvider>
```
UIProvider устанавливает `data-theme`, `data-platform`, `data-skin` на `document.documentElement`
(или на `config.root`), и может применить `config.vars` — набор CSS variables.
## Runtime switching
```tsx
const [theme, setTheme] = useState<"light"|"dark">("dark");
<UIProvider config={{ theme, platform, skin }} />
```
## Which combos matter
- `platform="vk" + skin="ios"` — VK iOSвид (Cupertinoощущение)
- `platform="vk" + skin="android"` — VK Androidвид (Materialощущение)
- `platform="tg"` — более “telegramui” акценты
- `platform="web"` — нейтральный web preset
## Troubleshooting
Если визуально не меняется “skin”, значит компоненты ещё используют жёсткие px.
Нужно заменить размеры на токены (`--btn-*`, `--input-*`, `--cell-*`, `--tabbar-*`) и т.п.