design.md icon indicating copy to clipboard operation
design.md copied to clipboard

Feature: add Iconography section and `icons.*` tokens

Open dovas-net opened this issue 7 months ago • 4 comments

Summary

Add a formal ## Iconography section and an icons.* token group to the DESIGN.md spec. The current spec already uses ## Iconography as its illustrative example of a valid-but-undefined unknown section (docs/spec.md, "Consumer Behavior for Unknown Content" table); this proposal fills that gap.

Motivation

Every example DESIGN.md in the repo — paws-and-paths, atmospheric-glass, totality-festival — describes icons in prose but has no token slot for them. Agents consuming these files today have to infer the icon library, style variant, and size scale from surrounding context. That defeats the "consistent visual identity across tools" goal: two agents reading the same DESIGN.md will pick different icon sets.

Iconography is a visual-language primitive alongside Colors, Typography, Elevation, and Shapes, and belongs in the token schema.

Proposal

Token group

icons:
  library: "Lucide"              # string — required within this group
  style: "outlined"              # enum (optional): outlined | filled | rounded | sharp | duotone
  strokeWidth: 1.5               # number (optional) — stroke-based libraries (Lucide, Tabler, Feather); font-based libraries map agent-side
  grid: 24px                     # Dimension (optional) — source viewBox unit; e.g. Radix=15, Phosphor=256, most others=24
  size:                          # map<string, Dimension> (optional)
    sm: 16px
    md: 24px
    lg: 32px
  color: "{colors.on-surface}"   # Color | token ref (optional)

Section placement

New ## Iconography section inserted between Shapes and Components in the canonical section order. Rationale: it sits with the other visual-language primitives (Colors, Typography, Elevation, Shapes) and immediately precedes Components, where icon tokens are consumed.

Prose example

## Iconography

Icons use **Lucide** in its outlined style at a 1.5 stroke weight, echoing
the calm, linear rhythm of the typography. Icons render on a 24px grid and
inherit `on-surface` color by default.

- **Small (16px):** Inline with body text or dense tables.
- **Medium (24px):** Default for buttons, navigation, and form fields.
- **Large (32px):** Feature tiles and empty states.

Recommended token names (non-normative)

Add two entries to the existing "Recommended Token Names" list, matching its existing paragraph format:

Icon Styles: outlined, filled, rounded, sharp, duotone

Icon Sizes: sm, md, lg

Design decisions

  • library is a free-form string — the icon ecosystem is long-tail and new libraries appear constantly; an enum would calcify.
  • style enum covers five canonical values drawn from a survey of Material Symbols, Heroicons, Phosphor, Font Awesome, Tabler, Lucide, Ionicons, Carbon, and Fluent. Unknown values accepted with warning, matching the spec's existing behavior.
  • strokeWidth is the cross-library weight concept. Font-based libraries (e.g., Material Symbols weight 100–700) map it agent-side.
  • color accepts token refs so icons participate in theming automatically as soon as #13 (themes) lands.
  • size mirrors spacing's map-of-named-steps pattern for consistency with existing token group conventions.
  • grid describes the source viewBox, not the render size. This disambiguates "what unit is strokeWidth in?" for libraries on non-24 grids (Radix 15, Phosphor 256).

Deferred to follow-up

Each of these is a real case worth solving, but each is also its own design debate. Deferring keeps v1 focused on the 80% case:

  • Duotone secondaryColor — only Phosphor Duotone and FA Duotone need it; adding a union-typed color field or a sibling secondaryColor is worth discussing in isolation.
  • Separate weight axis vs unified strokeWidth — Material Symbols' 100–700 weight range may not map cleanly to a single stroke number; worth empirical validation.
  • Multi-library map — real pattern (Lucide UI + Simple Icons for brand logos); prose handles it in v1.
  • Optical-size variant selection — Carbon, Fluent, and Material Symbols ship different icon files per render size; v1 treats size.* as CSS output only, agent picks the right source file if the library supports optical sizing.

Library-specific constraints (not schema concerns)

Some libraries couple fields in ways the schema can't express:

  • Heroicons — "mini" is always solid 20px; "micro" is always solid 16px. style: "outlined" + size.sm: 16px is invalid for Heroicons specifically.
  • Material Symbols — the fill/weight/grade/optical-size axes are library-specific and resolved agent-side.

These constraints live at the agent/library boundary, not in the linter — the schema stays library-agnostic.

Backwards compatibility

Purely additive. Existing DESIGN.md files without an icons block or ## Iconography section parse and lint identically. No version bump required (spec is in alpha; additive schema changes are in-scope).

Consumer-side impact

  • ## Iconography is used in docs/spec.md as the example unknown section. When this lands, that example row should be swapped (e.g., to ## Illustrations) to avoid self-contradiction.
  • export commands (Tailwind, DTCG): neither format has an icon token concept; v1 passes icon tokens through unchanged rather than emitting them.
  • import command (#40): Tailwind configs and DTCG files do not carry icon metadata; import is a no-op for icons.

dovas-net avatar Apr 23 '26 17:04 dovas-net

Thank you so much for this idea @dovas-net. There's a lot I like here. I need to dig in a bit and think through some things. I'll get back to you over the next few days.

davideast avatar May 01 '26 23:05 davideast

Love this proposal! I agree on the need for a more formal way to represent iconography, as it has an outsized impact on the branded appearance of a system.

Atlassian for example, has its own unique set of custom-drawn icons, and those icons are individually documented with metadata on their purpose and recommended use cases. It'd be great to be able to more formally link out to an external icon library, and metadata that an AI can query to learn about each icon and how to use it.

To build on @dovas-net's recommendation, there are two more options that would help encode more of the unique character of a given icon set:

  • End cap style: Are the end of strokes round or square?
  • Line join style: Are the internal corners round, bevel or another value?

These are a bit more specific, but would provide more context if an agent was (in the future) to generate icons from scratch based on a pre-defined style

AndrewOCC avatar May 18 '26 06:05 AndrewOCC

feel free to add to the open pull request (https://github.com/google-labs-code/design.md/pull/44) @AndrewOCC

dovas-net avatar May 18 '26 11:05 dovas-net

Hey @dovas-net, @AndrewOCC, apologies for the delay on this.

I've been working through this and several related proposals (#47, #49, #65) together. Published a PHILOSOPHY.md that explains the thinking on what tokens are for in the spec vs. what prose carries.

The short version: I agree that Iconography belongs in the spec as a section. I opened #101 to track the work. The direction there is a prose-first ## Iconography section with non-normative token examples as references, not requirements. Would love your input on that issue.

For projects that want structured icon tokens beyond what the spec prescribes, we're also building linter extensibility so custom properties can be registered without spec changes.

Thanks for pushing on this as it directly shaped the direction. I'm closing to track in #101.

davideast avatar Jun 15 '26 21:06 davideast