Styling contract
Style the component layer by overriding semantic tokens on the toggle, the group, or an ancestor shell. Avoid depending on internal wrapper DOM beyond the documented state hooks.
| Surface | Recommended contract | Why it is safe |
|---|---|---|
tng-toggle | Set semantic tokens such as --tng-semantic-accent-brand and --tng-semantic-background-surface. | The rendered internal button inherits those values without exposing private DOM in your app styles. |
tng-toggle-group | Adjust layout, spacing, and supporting shell styles on the host element. | The group host is public, and selection logic stays inside the wrapper. |
| Ancestor shell | Define a token set on a surrounding card to theme several toggles together. | CSS custom properties inherit cleanly into every nested toggle. |
| Token | Typical use |
|---|---|
--tng-semantic-accent-brand | Selected toggle background and border. |
--tng-semantic-background-surface | Idle toggle surface. |
--tng-semantic-border-strong | Idle toggle border. |
--tng-semantic-foreground-primary | Icon or glyph color inside the toggle. |
--tng-semantic-focus-ring | Focus-visible ring color. |
Host-level token overrides
css
.release-toggle-shell {
border: 1px solid var(--tng-semantic-border-subtle);
background: var(--tng-semantic-background-surface);
}
User scenario style examples
Use the same component contract inside a plain CSS shell or a Tailwind shell by overriding host-level semantic tokens.
Release checklist (Plain-CSS)
Release checklist
Use token overrides on the wrapper shell so the component keeps its internal DOM private.
Review
QA
Docs
Release checklist (Tailwind CSS)
Release checklist
Use token overrides on the wrapper shell so the component keeps its internal DOM private.
ReviewHuman approval before publish.
QARegression sign-off from the test pass.
DocsRelease notes and migration guidance.