Editing tokens

Docs

The editor is one row per token, under three tabs that are the three tiers. A row's controls depend on its tier: a design token holds a value, a semantic token two references, a component token one.

How to use it

Design tab. A colour row shows a swatch; click it for a picker with a hex field. Every other row shows its value in a field. Shadow rows add a tint picker that recolours every layer of the shadow at once.

Semantic tab. A colour row shows two reference pickers, light (sun) then dark (moon), each listing the design tokens of its category. A non-colour semantic row (radius, spacing, typography, shadow) shows one picker that sets both themes: a corner that differs between light and dark is a mistake nobody asks for. A project whose dark reference already differs shows an amber note until any pick resyncs them.

Gradients. The Semantic tab's gradient group holds up to three gradients, one per role: Primary and Accent (read with primary-foreground and accent-foreground) and Page wash (surface-gradient, behind body text, read with foreground and muted-foreground). Add gradient offers each missing role by name and makes it from that role's colour: the primary or accent ramp one shade darker to one lighter at 135deg, or your page colour to a slightly darker shade (toward black in dark) at 180deg. Each shows in light and dark, its direction in whole degrees (to right or -45 become that form when you leave the field), Painted on checkboxes and its stop colours as ordinary colour rows, saved with your other edits. The button and badge take the primary or accent gradient, the card and hero the page wash, the CTA band the primary one; a surface painting the other brand gradient says (uses Accent), and ticking it moves it. Ticking the button, badge or card also moves its text onto that gradient's text colour (accent-foreground for Accent), and unticking moves it back; text you pointed elsewhere by hand stays put, and says text would fail contrast when it would. Remove deletes the gradient, its stops and its surfaces' links at once, after a confirm. Adding, removing or ticking takes effect at once and is not an unsaved edit.

Component tab. A row shows one reference picker, over semantic and design tokens of its category, and its chip splits light over dark so both themes are readable without flipping the preview.

Deleting. The trash icon on a row (shown on hover or focus, always on a touch screen), behind a confirm with Cancel and Delete. Deleting takes effect at once, in both themes, and is not an unsaved edit, so Discard and undo cannot bring it back. A token something still references (unsaved edits included) cannot be deleted: the dialog says Can't delete this token, lists what references it, and offers only Close; point those at another token first.

A tab wears an amber dot while it holds an unsaved edit; the group headings inside do too.

How it works

The tier rules are enforced on every write, in the editor and on the API: a design token holds a raw value and no references; a semantic token holds a light and a dark reference to design tokens of its category and no value; a component token holds one reference to a semantic or design token of its category, no dark reference, and names its component. A reference also stays inside typography's kinds, so a font-size slot cannot point at a family. Semantic and component tokens share one CSS namespace, so a component slot whose variable another token already emits is refused. The exact lists are on Token categories and tier rules.

A design colour row shows no value text beside its swatch; the value is the swatch's title and the hex field inside the picker. A design colour that is referenced is what the semantic and component rows resolve to, so changing it repaints everything that reaches it.

Component slot names come from a hand-kept list pinned to the kit's source: a slot the kit reads becomes a CSS variable the preview and the exports honour; a name outside the list emits a variable nothing renders.

Edits are an overlay over the saved tokens until Save; see Saving, undo and redo.

What can go wrong

  • Name may only contain letters, digits, dots, hyphens, and underscores, and the tier lines (Design tokens cannot hold references, Semantic tokens require a dark reference, Component tokens cannot have a dark reference — theming comes from the semantic token) are the editor's own refusals.
  • Token "…" already exists: names are unique per tier, category and component.
  • Cannot delete: … is a gradient stop; delete the gradient first, … paints a gradient; untick it in the gradient's group or remove the gradient instead, or a rename of a stop refused: a gradient, its stops and its surfaces' gradient tokens are removed together, with Remove or a checkbox in the gradient group. "accent-gradient-from" already exists; rename it first means a colour of yours already has a name a new gradient's stop needs.
  • A design value that is not a plain CSS value (url(), an expression) is refused; values stop at 500 characters, names at 100.