Toggle: codeai-next (CADS) brand styles#74004
Conversation
Brand-scoped override block for the states the token bridge cannot express: the ON side moves to the dedicated mode-inverted selected tokens (track, thumb, icon), the OFF track shifts one step down the neutral ramp (septenary/octonary vs legacy senary/septenary — same-name tokens the bridge cannot retarget), and disabled icons take the disabled-inverse label. The thumb references the not-yet-exported --background-selected-primary-inverse with a --text-selected-primary fallback that carries the identical value pair. Legacy brands render byte-identically; every declaration sits under [data-brand='codeai-next']. Same pattern as Tags (#73901) and Chips (#74003). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f01b73137e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
🖼️ Storybook Visual Comparison Report✅ No Storybook eyes differences detected! |
There was a problem hiding this comment.
Pull request overview
Adds data-brand='codeai-next'-scoped (CADS) styling overrides to the DSCO Toggle component so Toggle colors match CADS semantics under the CodeAI-next brand while keeping legacy brands byte-identical.
Changes:
- Add a
[data-brand='codeai-next']override block in Toggle SCSS to swap ON/OFF track, thumb, and icon colors to CADS selected/neutral tokens. - Re-declare hover/pressed/disabled combinations under the brand scope to preserve the intended cascade without
!important. - Add a CSS variable fallback for the selected thumb “primary-inverse” token until it exists in the sandbox export.
Fixes the dark-mode contrast finding from review: the CADS neutral ramp inverts in Dark (septenary resolves to gray-30), so the legacy fixed-white thumb and x icon sat at ~1.9:1 on the OFF track, below the 3:1 UI-component threshold. Per the Figma spec the thumb fill is background/neutral/primary (theme-following); the OFF icon pairs with text-neutral-primary-inverse. Light rendering is unchanged (both resolve to white); Dark now renders black-on-gray. The disabled thumb keeps the legacy white-fixed fill. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Re the Eyes report: the diffs are all in the markdown package's e2e visual tests, which this PR doesn't touch — the same |
Before:

After:

What
Adds
[data-brand='codeai-next']-scoped styles to the DSCO Toggle component, per-component brand-override pattern from #73901 (Tags) / #74003 (Chips):code/codeai)codeai-next(this PR)--background-brand-teal-primary--background-brand-primary(purple-50)--background-selected-primary--text-neutral-white-fixed(always white)--text-selected-primary--background-neutral-white-fixed--background-selected-primary-inverse(see below)--background-brand-teal-strong--background-brand-strong--background-selected-hover(+ matching pressed border)--background-neutral-senary--background-neutral-septenary--background-neutral-septenary--background-neutral-octonary--text-disabled-neutral-inverse(white in Light, black in Dark)The ON side is the mode-inverted selected triple from the Figma component spec (
background/state/selected/primarytrack,background/state/selected/primary-inversethumb,text/state/selected/primaryicon): brand track + seafoam thumb/icon in Light, seafoam track + navy thumb/icon in Dark. The OFF neutrals are the same-name tokens read off the Figma variants — one ramp step darker than legacy, which the name-for-name bridge cannot express.Everything else resolves correctly through the token bridge (#73701): the focus ring (legacy teal →
--border-brand-primary, the CADS indigo), the disabled track fills (--background-neutral-disabled→--background-disabled-neutral), the label text, and the OFF/disabled thumb (white fixed).Legacy brands render byte-identically — every new declaration sits under the
[data-brand='codeai-next']scope.The missing thumb token
The Figma thumb token
background/state/selected/primary-inverseis not in thecolors_codeAi.csssandbox export yet. The thumb references it with a fallback:--text-selected-primarycarries the identical value pair by design (the export documents that selected text always pairs with the selected background), so the rendering is correct today, and the reference self-heals when a sandbox re-export adds the token — same forward-compat pattern asvar(--shape-sm, …)in #73901.Cascade notes
Each override mirrors its legacy counterpart's selector plus the
[data-brand]attribute — no!important. Verified against the compiled output::checked:not(:disabled), so the disabled thumb stays white (per Figma).--border-selected-hovermatches--background-selected-hoverby design on the ON side; the OFF side has no matching border token, so its pressed border stays at the transparent base.Deliberately not in this PR
QA
?brand=codeai-next(needs DCDObrand-router-enabled);?brand-reset=1to clear.Testing
🤖 Generated with Claude Code