ShtukbaseStandard
page/design/contract.md

The token contract

The fixed list of CSS custom property names that a style defines, that components use and that viewers read: what is required, what is optional, how a style meets it, the check.

Page fields (1)
icon🤝

One list of names joins every design package. A style fills the list. Components use only the names on the list. Viewers (the style specimen, the component catalog) read the list. So a style, a component library and a viewer can each be swapped for another one built to the same contract. The list is data: contract.json, version 1.

Why these names (owner decision, 29.11.2026)

The base of the contract is the shadcn/ui theme variables, unchanged: they are the most widely used set of theme names, so every shadcn theme and every theme generator already produces a valid style, and shadcn components take our style as it is. The fonts and shadows are the Tailwind v4 theme namespaces. Only what these two lack is our own, under the prefix --sb-.

What a style defines

A style is a set of CSS custom properties on :root (the light scheme) and on .dark, [data-theme="dark"] (the dark scheme).

Required, the shadcn theme names. Every colour name has a value in both schemes.

GroupNames
Surface--background, --foreground, --card, --card-foreground, --popover, --popover-foreground
Action--primary, --primary-foreground, --secondary, --secondary-foreground, --accent, --accent-foreground, --destructive
Quiet--muted, --muted-foreground, --border, --input, --ring
Charts--chart-1 … --chart-5
Sidebar--sidebar, --sidebar-foreground, --sidebar-primary, --sidebar-primary-foreground, --sidebar-accent, --sidebar-accent-foreground, --sidebar-border, --sidebar-ring
Shape--radius (one value for both schemes)

Optional, the Tailwind v4 namespaces (one value for both schemes): --font-sans, --font-mono, --shadow-sm, --shadow-md, --shadow-lg. A plain shadcn theme does not set them, so they have defaults (the system fonts, the Tailwind shadows): any shadcn theme passes the check as it is (the owner, 29.11.2026: as compatible with shadcn as possible).

Optional, our extension, with defaults. A style may leave these out; the default in contract.json applies, and it is derived from the required names, so a plain shadcn theme still works.

NameWhatDefault
--font-displaythe display font--font-sans
--sb-hue-1 … --sb-hue-12the palette; each has -soft (a light fill), -tint (a lighter fill), -ink (text on the fill)the five chart colours, repeated; the fills mixed with --background, the ink with --foreground
--sb-shadow-liftthe hover shadow--shadow-md
--sb-shadow-sheetthe shadow of area backgrounds--shadow-sm
--sb-glowthe rim of the Basic card, a box-shadowa thin ring of --primary
--sb-edgethe card edge, a box-shadowa thin ring of --border
--sb-ease, --sb-durthe motion curve and durationcubic-bezier(0.2, 0, 0, 1), 160ms

contract.json

{"version": 1, "required": ["--background", "…"], "colors": ["--background", "…"], "extension": {"--font-display": "var(--font-sans)", "…": "…"}}
  • required: every name a style must define in :root.
  • colors: the required names that need a dark value too.
  • extension: each optional name with its default value.

Other packages read it with readContract() from the design-tokens package (lib/contract.ts): the style packages for their own checks, the viewers for the specimen, the libraries for the defaults.

How a style meets the contract

  1. Write the tokens as DTCG files: /design/<style>/tokens.json and /design/<style>/tokens.dark.json. A token path maps to a name: card-foreground is --card-foreground, sb.hue.1 is --sb-hue-1.
  2. Build them with the build action of this package (the dark selector is .dark, [data-theme="dark"]) into /design/<style>/tokens.css.
  3. Choose the style on Design: style: <style id>.
  4. Run shtuk check: the check contract (DTK-R03) fails when a required name or a dark value is missing. It names the optional names left out, so you see which defaults apply.

For any CSS file by hand (a shadcn theme, a generator's output): shtuk run design-tokens contract --css <file>.

The same judgement as a report that never fails, in bands (full, missing, fallbacks, extra): shtuk run design-tokens health. How to make a style from a skeleton: the convention A design style.

Versions

The contract is versioned (version in contract.json). A library says which version it needs; a change that removes or renames a required name is a new version, a new optional name is not.

The package Design tokens (W3C DTCG) puts this page at /design/contract.md.Source text