Design tokens: themes on any element, primary-inverse, form template
Follow-ups from the reference site's first visual test: - data-theme="dark"/"light" switches the tokens on any element (LIGHT_SELECTOR, DARK_SELECTOR as selector lists); the base layer colours a themed panel's text - inverted sections re-map primary / primary-hover / primary-text to the new primary-inverse / primary-inverse-text roles; the contrast report checks them (inherited roles resolved on the ancestor, as the cascade does) - ipal-form formClasses.ts on token utilities + buttonClass(); theme.md: one-icon ThemeSwitcher pattern (the default two-option toggle stays) Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
51f80cea13
commit
d6675d2979
@@ -68,6 +68,13 @@ import { ThemeSwitcher } from '@intecion/ipal-kit/client'
|
||||
/>
|
||||
```
|
||||
|
||||
Both icons render: the default is a two-option toggle with the active one highlighted (the `classNames` above).
|
||||
For one icon that changes with the theme (sun in light, moon in dark), hide the other with the `dark:` variant:
|
||||
|
||||
```tsx
|
||||
<ThemeSwitcher label={themeLabel} classNames={{ light: 'block dark:hidden', dark: 'hidden dark:block' }} />
|
||||
```
|
||||
|
||||
`<button role="switch" aria-checked>` (checked = dark). Which button looks active is decided by CSS
|
||||
from the attribute on `<html>` (`dark:`), not React state — nothing jumps after hydration.
|
||||
Hooks for styling: `data-ipal="theme-switch"`, `data-ipal-theme-icon="light|dark"`.
|
||||
|
||||
Reference in New Issue
Block a user