Components
The components block maps named UI components to concrete style properties backed by your design tokens.
Component properties
In the DESIGN.md specification, each component entry accepts these normative properties:
| Property | Expected value |
|---|---|
backgroundColor | Color literal or {colors.*} reference |
textColor | Color literal or {colors.*} reference |
typography | Composite {typography.*} reference |
rounded | Dimension literal or {rounded.*} reference |
padding | Dimension literal or {spacing.*} reference |
size | Dimension literal or {spacing.*} reference |
height | Dimension literal or {spacing.*} reference |
width | Dimension literal or {spacing.*} reference |
components:
button-primary:
backgroundColor: "{colors.primary}"
textColor: "{colors.on-primary}"
typography: "{typography.label-md}"
rounded: "{rounded.md}"
padding: 12pxUnlike global token categories, components allows references to composite {typography.*} tokens alongside primitive {colors.*}, {rounded.*}, and {spacing.*} tokens.
Interactive states as sibling entries
Express hover, active, focus, and disabled states as flat sibling keys rather than nested objects under a component:
components:
button-primary:
backgroundColor: "{colors.primary}"
textColor: "{colors.on-primary}"
rounded: "{rounded.md}"
padding: 12px
button-primary-hover:
backgroundColor: "#3730a3"
textColor: "{colors.on-primary}"
rounded: "{rounded.md}"
padding: 12px
button-primary-disabled:
backgroundColor: "{colors.surface}"
textColor: "{colors.text-muted}"
rounded: "{rounded.md}"
padding: 12pxKeeping states flat guarantees every entry resolves uniformly in symbol tables (components.button-primary-hover.backgroundColor) and exports cleanly across tools.
What belongs in prose instead
Borders, box shadows, internal flex/grid gaps, icon sizing rules, and responsive stacking do not have dedicated properties in the YAML components schema. Document them in the ## Components Markdown section so agents receive structural guidance without bloating the YAML schema:
## Components
- **Primary button (`button-primary`):** Minimum width `96px`, `1px` transparent border to prevent layout shift when paired with outlined secondary buttons, and `8px` gap between icon and label.
- **Card surface (`card-surface`):** Use a `1px solid` `{colors.border}` hairline instead of drop shadows on desktop grids.External template references
Components may point to reference HTML or component snippets using inline code references such as:
@components/button.html@components/card.html#card-elevated
Paths resolve relative to the directory containing DESIGN.md.
Automated component contrast checks
When you paste a DESIGN.md into the DesignMD Pro Validator, the linter checks every component’s foreground properties (color, text, textColor, foreground) against its background properties (background, backgroundColor, bg, surface, fill):
- Ratio
< 3:1→ error (low-contrast) - Ratio
3:1to4.49:1→ warning (low-contrast) - Ratio
>= 4.5:1→ passes WCAG AA for normal text
For example, in button-primary-disabled above, verifying {colors.text-muted} (#52525b) against {colors.surface} (#f6f5f4) keeps disabled labels legible.
Next steps
- Prose Sections — write the
## Componentsnarrative alongside other ordered sections - Complete Example — inspect a full multi-component
DESIGN.md - Validator & Lint Rules — see every reference and contrast check