Theming, Design Tokens & i18n
Live Examples
1. Built-in & Custom Themes (themes + themeTokens)
Alongside built-in 'dark' and 'light' themes, register custom themes in themes inheriting from base: 'dark' | 'light'.
Token Cascade Priority
Tokens resolve from general to specific:
1. Built-in base palette ('dark' or 'light')
↓
2. themeTokens (shared brand defaults applied across every theme)
↓
3. themes[activeThemeId] (theme-specific tokens — highest priority)Built-in dark / light Overrides
You can also pass dark and light keys inside themes to give each built-in theme its own brand accent or border color without inventing extra theme IDs.
import { RedDokia } from 'reddokia/react';
<RedDokia
views={views}
layout={layout}
themeTokens={{ islandRadius: '10px' }}
themes={{
dark: { accent: '#818cf8' },
light: { accent: '#4f46e5' },
ocean: {
base: 'dark',
islandRadius: '16px', // overrides shared 10px when ocean is active
shellBg: '#07131f',
panelBg: '#0c1f33',
contentsBg: '#0a1929',
groupHeaderBg: '#102840',
accent: '#38bdf8',
border: '#1e3a5f',
},
warmPaper: {
base: 'light',
islandRadius: '6px',
shellBg: '#f5efe6',
panelBg: '#fbf8f3',
contentsBg: '#fffdf9',
groupHeaderBg: '#efe7da',
accent: '#b45309',
border: '#dfd3c3',
},
}}
/><template>
<RedDokia
:views="views"
:layout="layout"
:theme-tokens="{ islandRadius: '10px' }"
:themes="themes"
/>
</template><RedDokia
views={views}
layout={layout}
themeTokens={{ islandRadius: '10px' }}
{themes}
/>const dock = new RedDokia(container, {
views,
layout,
themeTokens: { islandRadius: '10px' },
themes: {
ocean: { base: 'dark', accent: '#38bdf8', shellBg: '#07131f' },
},
});
dock.setTheme('ocean'); // switches main window + all open OS pop-out windowsCore Design Tokens Reference
| Token Property | CSS Variable | Purpose |
|---|---|---|
shellBg | --rd-shell-bg | Outer workbench backdrop |
topBarBg / edgeBarBg | --rd-topbar-bg, --rd-edgebar-bg | TopBar and EdgeBar rail surfaces |
groupHeaderBg | --rd-group-header-bg | Tab group header bar |
contentsBg / panelBg | --rd-contents-bg, --rd-panel-bg | Central contents & side panel surfaces |
accent / accentSecondary | --rd-accent, --rd-accent-secondary | Primary & secondary highlight colors |
border | --rd-border | Panel & divider borders |
textMain / textMuted | --rd-text-main, --rd-text-muted | Primary & muted foreground typography |
islandRadius | --rd-island-radius | Corner radius for island panel groups |
fontSans / fontMono | --rd-font-sans, --rd-font-mono | UI and monospace font stacks |
2. Localization (locale · localeStrings)
Built-in dictionaries cover 'en' (default), 'ko', and 'ja'; register any custom locale code (e.g., 'fr', 'zh-CN') via localeStrings with automatic 'en' fallback.
Flat vs. Per-Locale localeStrings
Pass either a flat partial object or a per-locale map ({ ko, en, ja, ... }) to localeStrings so controller.setLocale() switches custom strings automatically:
<RedDokia
views={views}
layout={layout}
locale="ko"
localeStrings={{
ko: { closeTabTooltip: '탭 닫기 (Custom)' },
en: { closeTabTooltip: 'Close Tab (Custom)' },
ja: { closeTabTooltip: 'タブを閉じる (Custom)' },
fr: { closeTab: 'Fermer', closeTabTooltip: 'Fermer l’onglet' },
'zh-CN': { closeTab: '关闭', closeTabTooltip: '关闭标签页' },
}}
/>Reading the Active Locale Inside Panels
Call controller.getLocale() inside any panel to localize your own view copy in sync with RedDokia's built-in context menus and tooltips.