Skip to content

feat: dynamic radius — numeric token scale, multiplier & radiusScale config - #686

Merged
cixzhang merged 1 commit into
mainfrom
navi/feat/radius-vibe-test
Mar 18, 2026
Merged

cixzhang merged 1 commit into
mainfrom
navi/feat/radius-vibe-test

Conversation

@cixzhang

@cixzhang cixzhang commented Mar 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Implements the dynamic radius system from #669.

Token Rename (semantic → numeric scale)

Old (semantic) New (numeric) Value
--radius-inner --radius-0 0px (fixed)
--radius-content --radius-1 4px
--radius-element --radius-2 8px
--radius-container --radius-3 12px
--radius-page --radius-4 16px
--radius-rounded --radius-rounded 9999px (fixed)

Base unit: 4dp. Tokens 1–4 = base × step × multiplier. Tokens 0 and rounded are fixed.

radiusScale on defineTheme

New config option following the typeScale pattern:

defineTheme({
  radiusScale: { base: 4, multiplier: 1 },    // default
  radiusScale: { base: 4, multiplier: 0 },    // sharp/brutalist
  radiusScale: { base: 4, multiplier: 1.5 },  // rounded
})
  • Generates all 6 radius tokens from base + multiplier
  • Explicit tokens overrides take precedence over radiusScale values
  • multiplier: 0 → sharp, 1 → default, 1.5 → rounded, 2 → pill-like

Theme Updates

Theme Approach Result
Default base: 4, multiplier: 1 0/4/8/12/16/9999px
Neutral Explicit token overrides Matches shadcn-like values (0.25/0.375/0.625/0.75rem)
Brutalist radiusScale: { base: 4, multiplier: 0 } + --radius-rounded: 0px Everything sharp

Skeleton Backwards Compat

The radius prop on XDSSkeleton accepts both old semantic names and new numeric names for backwards compatibility.

Vibe Test Results

A/B tested semantic vs numeric naming with 12 radius-focused prompts (results):

  • Both achieved 100% LLM success rate
  • Numeric handles deep nesting better (5 hierarchy levels vs 3)
  • Numeric naturally supports the multiplier pattern

New Files

  • packages/core/src/theme/expandRadiusScale.ts — radius scale expansion utility
  • packages/core/src/theme/expandRadiusScale.test.ts — tests (6 cases)
  • internal/vibe-tests/test-sets/radius-tokens.json — radius-focused vibe test prompts
  • internal/vibe-tests/prompts/radius-evaluator.md — radius-specific evaluator

Files Changed

61 files — bulk of changes are mechanical token renames across ~40 component files.

Closes #669


…config (#669)

Implements the radius token system from issue #669:

## Token Rename (semantic → numeric scale)
- --radius-inner (0px)     → --radius-0
- --radius-content (4px)   → --radius-1
- --radius-element (8px)   → --radius-2
- --radius-container (12px)→ --radius-3
- --radius-page (20px)     → --radius-4 (16px)
- --radius-rounded (9999px)→ --radius-rounded (unchanged)

Base unit: 4dp. Tokens 1-4 = base × step × multiplier.
Tokens 0 and rounded are fixed (unaffected by multiplier).

## radiusScale on defineTheme
New config option following the typeScale pattern:
  defineTheme({ radiusScale: { base: 4, multiplier: 1 } })

- Generates all 6 radius tokens from base + multiplier
- Explicit token overrides take precedence
- multiplier: 0 → sharp, 1 → default, 1.5 → rounded, 2 → pill-like

## Theme updates
- Default: base=4, multiplier=1 (0/4/8/12/16/9999px)
- Neutral: explicit token overrides (values don't follow clean scale)
- Brutalist: radiusScale { base: 4, multiplier: 0 } + --radius-rounded: 0px

## Skeleton backwards compat
radius prop accepts both old semantic names and new numeric names.

Vibe tested: A/B comparison showed numeric naming handles deep nesting
better (5 hierarchy levels vs 3) while maintaining 100% LLM success rate.

Co-authored-by: Navi <[email protected]>
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 18, 2026
@github-actions

github-actions Bot commented Mar 18, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

AppShell · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 801B N/A
Lines of Code N/A 544 -
Complexity N/A Very High (88) -
Banner · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 429B N/A
Lines of Code N/A 276 -
Complexity N/A High (21) -
Button · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 333B N/A
Lines of Code N/A 290 -
Complexity N/A High (22) -
Card · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 265B N/A
Lines of Code N/A 113 -
Complexity N/A Medium (10) -
CheckboxInput · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 443B N/A
Lines of Code N/A 346 -
Complexity N/A High (28) -
DateInput · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 755B N/A
Lines of Code N/A 387 -
Complexity N/A Very High (47) -
Dialog · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 595B N/A
Lines of Code N/A 314 -
Complexity N/A Very High (38) -
DropdownMenu · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 687B N/A
Lines of Code N/A 503 -
Complexity N/A Very High (63) -
Field · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 818B N/A
Lines of Code N/A 504 -
Complexity N/A High (19) -
HoverCard · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 217B N/A
Lines of Code N/A 426 -
Complexity N/A Very High (44) -
Kbd · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 199B N/A
Lines of Code N/A 81 -
Complexity N/A Low (4) -
List · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 231B N/A
Lines of Code N/A 406 -
Complexity N/A Very High (37) -
MoreMenu · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 625B N/A
Lines of Code N/A 369 -
Complexity N/A Very High (49) -
NavItem
Metric Before After Delta
Bundle Size (ESM) N/A 181B N/A
Lines of Code N/A 58 -
Complexity N/A Low (1) -
Popover · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 345B N/A
Lines of Code N/A 467 -
Complexity N/A Very High (42) -
PowerSearch · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 1.4KB N/A
Lines of Code N/A 3038 -
Complexity N/A Very High (293) -
Selector · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 1.1KB N/A
Lines of Code N/A 921 -
Complexity N/A Very High (47) -
SideNav · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 1.1KB N/A
Lines of Code N/A 1334 -
Complexity N/A Very High (133) -
Skeleton · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 209B N/A
Lines of Code N/A 118 -
Complexity N/A Low (3) -
TabList · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 479B N/A
Lines of Code N/A 551 -
Complexity N/A High (26) -
TimeInput · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 499B N/A
Lines of Code N/A 379 -
Complexity N/A Very High (54) -
Token · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 267B N/A
Lines of Code N/A 355 -
Complexity N/A Medium (14) -
Tooltip · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 241B N/A
Lines of Code N/A 403 -
Complexity N/A Very High (47) -
TopNav · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 1.2KB N/A
Lines of Code N/A 1492 -
Complexity N/A Very High (92) -
TreeList · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 241B N/A
Lines of Code N/A 675 -
Complexity N/A Very High (60) -
Typeahead · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 619B N/A
Lines of Code N/A 863 -
Complexity N/A Very High (119) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@xds/core 10.5KB 16.8KB 2.6KB

Accessibility Audit

Status: 5 accessibility violation(s) found — 1 critical, 3 serious, 1 moderate.

XDSBanner - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/15 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
XDSList - 1 issue(s)
  • 🔴 critical: Ensure an element's role supports its ARIA attributes
    • Rule: aria-allowed-attr · Affects 1/10 stories · Learn more
    • WCAG: 4.1.2 (Level A)
XDSSideNav - 1 issue(s)
  • 🟠 serious: Ensure links have discernible text
    • Rule: link-name · Affects 1/8 stories · Learn more
    • WCAG: 2.4.4, 4.1.2 (Level A)
XDSTabList - 1 issue(s)
  • 🟡 moderate: Ensure landmarks are unique
    • Rule: landmark-unique · Affects 1/5 stories · Learn more
XDSToken - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/9 stories · Learn more
    • WCAG: 1.4.3 (Level AA)

Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@cixzhang
cixzhang merged commit 9c91d07 into main Mar 18, 2026
11 checks passed
@cixzhang
cixzhang deleted the navi/feat/radius-vibe-test branch March 18, 2026 20:43
cixzhang added a commit that referenced this pull request Apr 26, 2026
…config (#669) (#686)

Implements the radius token system from issue #669:

## Token Rename (semantic → numeric scale)
- --radius-inner (0px)     → --radius-0
- --radius-content (4px)   → --radius-1
- --radius-element (8px)   → --radius-2
- --radius-container (12px)→ --radius-3
- --radius-page (20px)     → --radius-4 (16px)
- --radius-rounded (9999px)→ --radius-rounded (unchanged)

Base unit: 4dp. Tokens 1-4 = base × step × multiplier.
Tokens 0 and rounded are fixed (unaffected by multiplier).

## radiusScale on defineTheme
New config option following the typeScale pattern:
  defineTheme({ radiusScale: { base: 4, multiplier: 1 } })

- Generates all 6 radius tokens from base + multiplier
- Explicit token overrides take precedence
- multiplier: 0 → sharp, 1 → default, 1.5 → rounded, 2 → pill-like

## Theme updates
- Default: base=4, multiplier=1 (0/4/8/12/16/9999px)
- Neutral: explicit token overrides (values don't follow clean scale)
- Brutalist: radiusScale { base: 4, multiplier: 0 } + --radius-rounded: 0px

## Skeleton backwards compat
radius prop accepts both old semantic names and new numeric names.

Vibe tested: A/B comparison showed numeric naming handles deep nesting
better (5 hierarchy levels vs 3) while maintaining 100% LLM success rate.

Co-authored-by: Navi <[email protected]>
cixzhang added a commit that referenced this pull request Jun 21, 2026
…config (#669) (#686)

Implements the radius token system from issue #669:

## Token Rename (semantic → numeric scale)
- --radius-inner (0px)     → --radius-0
- --radius-content (4px)   → --radius-1
- --radius-element (8px)   → --radius-2
- --radius-container (12px)→ --radius-3
- --radius-page (20px)     → --radius-4 (16px)
- --radius-rounded (9999px)→ --radius-rounded (unchanged)

Base unit: 4dp. Tokens 1-4 = base × step × multiplier.
Tokens 0 and rounded are fixed (unaffected by multiplier).

## radiusScale on defineTheme
New config option following the typeScale pattern:
  defineTheme({ radiusScale: { base: 4, multiplier: 1 } })

- Generates all 6 radius tokens from base + multiplier
- Explicit token overrides take precedence
- multiplier: 0 → sharp, 1 → default, 1.5 → rounded, 2 → pill-like

## Theme updates
- Default: base=4, multiplier=1 (0/4/8/12/16/9999px)
- Neutral: explicit token overrides (values don't follow clean scale)
- Brutalist: radiusScale { base: 4, multiplier: 0 } + --radius-rounded: 0px

## Skeleton backwards compat
radius prop accepts both old semantic names and new numeric names.

Vibe tested: A/B comparison showed numeric naming handles deep nesting
better (5 hierarchy levels vs 3) while maintaining 100% LLM success rate.

Co-authored-by: Navi <[email protected]>
cixzhang added a commit that referenced this pull request Jun 21, 2026
…config (#669) (#686)

Implements the radius token system from issue #669:

## Token Rename (semantic → numeric scale)
- --radius-inner (0px)     → --radius-0
- --radius-content (4px)   → --radius-1
- --radius-element (8px)   → --radius-2
- --radius-container (12px)→ --radius-3
- --radius-page (20px)     → --radius-4 (16px)
- --radius-rounded (9999px)→ --radius-rounded (unchanged)

Base unit: 4dp. Tokens 1-4 = base × step × multiplier.
Tokens 0 and rounded are fixed (unaffected by multiplier).

## radiusScale on defineTheme
New config option following the typeScale pattern:
  defineTheme({ radiusScale: { base: 4, multiplier: 1 } })

- Generates all 6 radius tokens from base + multiplier
- Explicit token overrides take precedence
- multiplier: 0 → sharp, 1 → default, 1.5 → rounded, 2 → pill-like

## Theme updates
- Default: base=4, multiplier=1 (0/4/8/12/16/9999px)
- Neutral: explicit token overrides (values don't follow clean scale)
- Brutalist: radiusScale { base: 4, multiplier: 0 } + --radius-rounded: 0px

## Skeleton backwards compat
radius prop accepts both old semantic names and new numeric names.

Vibe tested: A/B comparison showed numeric naming handles deep nesting
better (5 hierarchy levels vs 3) while maintaining 100% LLM success rate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dynamic Radius — Token Scale, Multiplier & Concentricity

1 participant