Skip to content

Theme package: Add element size design tokens - #76545

Merged
jameskoster merged 5 commits into
trunkfrom
add/theme-size-tokens
Jun 8, 2026
Merged

Theme package: Add element size design tokens#76545
jameskoster merged 5 commits into
trunkfrom
add/theme-size-tokens

Conversation

@jameskoster

@jameskoster jameskoster commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

What

Adds a size category to the dimension token family with eight design tokens for element sizing:

Token Value Description
--wpds-dimension-size-5xs 4px Notification indicators
--wpds-dimension-size-4xs 8px Visual size for small interactive elements like resize handles
--wpds-dimension-size-3xs 12px Small markers
--wpds-dimension-size-2xs 16px For small controls like checkboxes and radios, or small decorative icons
--wpds-dimension-size-xs 20px For medium sized icons
--wpds-dimension-size-sm 24px For icons and small buttons
--wpds-dimension-size-md 32px For medium-sized buttons and inputs
--wpds-dimension-size-lg 40px Default size for buttons and inputs

Why

Components like buttons, checkboxes, icons, tabs, and other interactive controls currently use hardcoded pixel values for sizing. A shared set of size tokens provides a consistent, predictable scale that can be referenced across components, reducing ad hoc values and making it easier to maintain visual consistency.

How

  • Added a size group to tokens/dimension.json with 5xs through lg entries, each referencing an existing space primitive (space.10 through space.80) so sizes align with the base spacing scale (4px–40px), including a 20px step at xs via space.50.
  • Added an ElementSize TypeScript type in terrazzo.config.ts so the scale is available as a union type ('5xs' | '4xs' | '3xs' | '2xs' | 'xs' | 'sm' | 'md' | 'lg').
  • Rebuilt prebuilt outputs (CSS custom properties, JS token lists, fallback values, TypeScript types, and docs).

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Design System Issues related to the system of combining components according to best practices. [Package] Theme /packages/theme [Type] Enhancement A suggestion for improvement.

Projects

Status: 💫 Done

Development

Successfully merging this pull request may close these issues.

6 participants