DESIGN.md Field Reference
Every top-level YAML key the parser recognizes, what value type each accepts, the three primitive token types (Color, Dimension, Reference), the seven typography sub-fields, the eight component sub-tokens, and the canonical section order. All drawn from @google/design.md 0.3.0 (spec-config.yaml and dist/linter/index.js).
Top-level frontmatter fields#
The parser recognizes exactly eight top-level YAML keys. Any other key is checked by the unknown-key rule (see the CLI reference).
Primitive token types#
Color#
A string starting with # followed by exactly six hexadecimal digits (case-insensitive, sRGB). No shorthand (three-digit) form is accepted.
colors:
primary: "#1A1C1E"
tertiary: "#B8422E"
neutral: "#F7F5F2"
Dimension#
A number followed immediately by a unit. The three accepted units are px, em, and rem. No space between the number and the unit. Negative values are valid (used for negative letter-spacing).
rounded:
sm: 4px
md: 8px
spacing:
base: 1rem
tight: 0.5em
typography:
body-md:
letterSpacing: "-0.02em"
Token Reference#
A string of the form {path.to.token} that resolves to a token defined elsewhere in the same frontmatter. The reference path is a dot-separated chain of YAML keys.
components:
button-primary:
backgroundColor: "{colors.primary}"
textColor: "{colors.on-primary}"
rounded: "{rounded.md}"
typography: "{typography.label-md}"
Depth limits (from spec-config.yaml):
A reference that points to a non-existent token triggers a broken-ref error (severity: error).
Typography object#
Each entry under typography maps a name to an object with up to seven sub-fields. All sub-fields are optional; a token with only fontFamily and fontSize is valid.
Example:
typography:
h1:
fontFamily: Public Sans
fontSize: 48px
fontWeight: 600
lineHeight: 1.1
letterSpacing: "-0.02em"
body-md:
fontFamily: Public Sans
fontSize: 16px
fontWeight: 400
lineHeight: 1.6
label-caps:
fontFamily: Space Grotesk
fontSize: 12px
fontWeight: 500
lineHeight: 1.0
letterSpacing: "0.1em"
Recommended token names (from spec-config.yaml): headline-display, headline-lg, headline-md, body-lg, body-md, body-sm, label-lg, label-md, label-sm. Custom names are accepted without error.
Component sub-tokens#
Each entry under components maps a component name to an object. The recognized sub-tokens are:
Unknown sub-token names produce a broken-ref warning (severity: warning), not an error. The valid sub-token names are: backgroundColor, textColor, typography, rounded, padding, size, height, width.
Example:
components:
button-primary:
backgroundColor: "{colors.primary-60}"
textColor: "{colors.primary-20}"
rounded: "{rounded.md}"
padding: 12px
button-primary-hover:
backgroundColor: "{colors.primary-70}"
Canonical section order#
Markdown sections (introduced with ## headings) must appear in this order when present. Sections may be omitted freely; only the relative order of those that do appear is checked.
| Position | Canonical name | Accepted aliases |
|---|---|---|
| 1 | Overview | Brand & Style |
| 2 | Colors | |
| 3 | Typography | |
| 4 | Layout | Layout & Spacing |
| 5 | Elevation & Depth | Elevation |
| 6 | Shapes | |
| 7 | Components | |
| 8 | Do's and Don'ts |
Out-of-order sections trigger a section-order warning. Additional or custom sections (Icons, Accessibility, Voice & Tone, etc.) are accepted and preserved by the parser without error. Duplicate top-level YAML keys across multiple code blocks in the same file trigger a parser-level error (the adapter returns a DUPLICATE_SECTION error code, e.g., "Section 'colors' is defined in both frontmatter and code block 2").
Recommended token names#
The spec-config defines recommended names per token group to maximize interoperability with agents and exporters:
Colors: primary, secondary, tertiary, neutral, surface, on-surface, error
Typography: headline-display, headline-lg, headline-md, body-lg, body-md, body-sm, label-lg, label-md, label-sm
Rounded: none, sm, md, lg, xl, full
These names are recommendations only. Custom names do not produce errors or warnings.
Spec version#
The current spec version is alpha (package @google/design.md 0.3.0). Inspect the live rules table with:
npx @google/design.md spec --rules
Was this page helpful?