Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

feat: dynamic radius — numeric token scale, multiplier & radiusScale config (#669) (#686)

Cindy Zhang0c1b86052ecb
diff --git a/apps/storybook/stories/AspectRatio.stories.tsx b/apps/storybook/stories/AspectRatio.stories.tsx
index 5f85c082b6..762aa0b63a 100644
--- a/apps/storybook/stories/AspectRatio.stories.tsx
+++ b/apps/storybook/stories/AspectRatio.stories.tsx
@@ -33,13 +33,13 @@ const styles = stylex.create({
width: '100%',
height: '100%',
objectFit: 'cover',
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
},
placeholder: {
width: '100%',
height: '100%',
backgroundColor: colorVars['--color-wash'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
@@ -48,7 +48,7 @@ const styles = stylex.create({
width: '100%',
height: '100%',
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
diff --git a/apps/storybook/stories/Center.stories.tsx b/apps/storybook/stories/Center.stories.tsx
index 962cfe70bd..7d123c1812 100644
--- a/apps/storybook/stories/Center.stories.tsx
+++ b/apps/storybook/stories/Center.stories.tsx
@@ -21,7 +21,7 @@ const styles = stylex.create({
borderColor: colorVars['--color-blue-border'],
paddingBlock: spacingVars['--spacing-4'],
paddingInline: spacingVars['--spacing-6'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
fontWeight: 500,
},
storyWrapper: {
@@ -33,7 +33,7 @@ const styles = stylex.create({
backgroundColor: colorVars['--color-blue-background'],
color: colorVars['--color-blue-text'],
padding: spacingVars['--spacing-2'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
},
});
diff --git a/apps/storybook/stories/Field.stories.tsx b/apps/storybook/stories/Field.stories.tsx
index 27f341f329..eb498b2cf1 100644
--- a/apps/storybook/stories/Field.stories.tsx
+++ b/apps/storybook/stories/Field.stories.tsx
@@ -22,7 +22,7 @@ const inputStyles = stylex.create({
borderWidth: 1,
borderStyle: 'solid',
borderColor: colorVars['--color-divider'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
backgroundColor: colorVars['--color-surface'],
color: colorVars['--color-text-primary'],
outline: 'none',
diff --git a/apps/storybook/stories/Grid.stories.tsx b/apps/storybook/stories/Grid.stories.tsx
index d20e2effe0..068bff843a 100644
--- a/apps/storybook/stories/Grid.stories.tsx
+++ b/apps/storybook/stories/Grid.stories.tsx
@@ -18,13 +18,13 @@ const styles = stylex.create({
item: {
padding: spacingVars['--spacing-4'],
backgroundColor: colorVars['--color-wash'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
textAlign: 'center',
},
featuredItem: {
padding: spacingVars['--spacing-6'],
backgroundColor: colorVars['--color-accent-deemphasized'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
textAlign: 'center',
height: '100%',
boxSizing: 'border-box',
@@ -32,7 +32,7 @@ const styles = stylex.create({
cardImage: {
height: 120,
backgroundColor: colorVars['--color-wash'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
marginBlockEnd: spacingVars['--spacing-3'],
},
storyWrapper: {
diff --git a/apps/storybook/stories/Layout.stories.tsx b/apps/storybook/stories/Layout.stories.tsx
index d5f15927c6..01812e15da 100644
--- a/apps/storybook/stories/Layout.stories.tsx
+++ b/apps/storybook/stories/Layout.stories.tsx
@@ -107,7 +107,7 @@ const styles = stylex.create({
// Demo container styling to visualize bounds
demoContainer: {
backgroundColor: colorVars['--color-card'],
- borderRadius: radiusVars['--radius-container'],
+ borderRadius: radiusVars['--radius-3'],
boxShadow: elevationVars['--elevation-base'],
},
// Demo sizing for outer padding story
diff --git a/apps/storybook/stories/Stack.stories.tsx b/apps/storybook/stories/Stack.stories.tsx
index acee08a7fa..963c9760bf 100644
--- a/apps/storybook/stories/Stack.stories.tsx
+++ b/apps/storybook/stories/Stack.stories.tsx
@@ -17,7 +17,7 @@ const styles = stylex.create({
borderColor: colorVars['--color-blue-border'],
paddingBlock: spacingVars['--spacing-4'],
paddingInline: spacingVars['--spacing-6'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
fontWeight: 500,
height: '100%',
boxSizing: 'border-box',
diff --git a/apps/storybook/stories/Table.stories.tsx b/apps/storybook/stories/Table.stories.tsx
index 8d2bde247f..ae337817de 100644
--- a/apps/storybook/stories/Table.stories.tsx
+++ b/apps/storybook/stories/Table.stories.tsx
@@ -204,7 +204,7 @@ export const CustomCellRenderer: Story = {
<span
style={{
padding: `${spacingDefaults['--spacing-0-5']} ${spacingDefaults['--spacing-2']}`,
- borderRadius: radiusDefaults['--radius-content'],
+ borderRadius: radiusDefaults['--radius-1'],
fontSize: textSizeDefaults['--text-xsm'],
backgroundColor:
item.role === 'Engineer'
diff --git a/apps/storybook/stories/ThemeEditor.stories.tsx b/apps/storybook/stories/ThemeEditor.stories.tsx
index 512d11b0dd..eec8037f24 100644
--- a/apps/storybook/stories/ThemeEditor.stories.tsx
+++ b/apps/storybook/stories/ThemeEditor.stories.tsx
@@ -865,7 +865,7 @@ function ComponentPreview() {
<pre
style={{
padding: '16px',
- borderRadius: 'var(--radius-element)',
+ borderRadius: 'var(--radius-2)',
backgroundColor: 'var(--color-wash)',
border: '1px solid var(--color-divider)',
fontFamily: 'var(--font-code)',
diff --git a/internal/vibe-tests/prompts/radius-evaluator.md b/internal/vibe-tests/prompts/radius-evaluator.md
new file mode 100644
index 0000000000..f72971c5f6
--- /dev/null
+++ b/internal/vibe-tests/prompts/radius-evaluator.md
@@ -0,0 +1,109 @@
+# Radius Token Evaluator
+
+You evaluate LLM-generated UI code specifically for correct radius token usage.
+
+## Input
+
+You will receive:
+
+- The user's prompt
+- The generated response (code)
+- The expected components
+- The token naming scheme being tested ("semantic" or "numeric")
+
+## Token Schemes
+
+### Semantic (current)
+
+| Token | Value | Usage |
+| ------------------ | ------ | --------------- |
+| --radius-rounded | 9999px | Pills, avatars |
+| --radius-container | 12px | Cards, modals |
+| --radius-element | 8px | Buttons, inputs |
+| --radius-content | 4px | Small elements |
+| --radius-inner | 0px | No radius |
+
+### Numeric (proposed)
+
+| Token | Value | Usage |
+| ---------------- | ------ | ------------------------------- |
+| --radius-rounded | 9999px | Pills, avatars |
+| --radius-4 | 16px | Page sections, large containers |
+| --radius-3 | 12px | Cards, modals |
+| --radius-2 | 8px | Buttons, inputs |
+| --radius-1 | 4px | Small elements |
+| --radius-0 | 0px | No radius |
+
+## Evaluation Criteria
+
+### 1. Correct Token Selection (most important)
+
+Did the LLM pick the **right radius level** for each element?
+
+- Containers (cards, modals, dialogs) → container/radius-3 (12px)
+- Interactive elements (buttons, inputs) → element/radius-2 (8px)
+- Small content (code blocks, inner elements) → content/radius-1 (4px)
+- Pills (badges, avatars) → rounded/radius-rounded (9999px)
+- No rounding (dividers, table cells) → inner/radius-0 (0px)
+
+### 2. Token Hallucination
+
+Did the LLM invent tokens that don't exist in the given scheme?
+
+- In semantic mode: using --radius-1, --radius-2, etc. is a hallucination
+- In numeric mode: using --radius-container, --radius-element, etc. is a hallucination
+- In either mode: using --xds-radius-_, --border-radius-_, etc. is a hallucination
+
+### 3. Hardcoded Values
+
+Did the LLM use raw pixel values instead of tokens?
+
+- `borderRadius: '12px'` instead of `var(--radius-container)` or `var(--radius-3)`
+- This is an anti-pattern (hardcoded_radius)
+
+### 4. Radius Hierarchy
+
+Did the LLM demonstrate understanding of the radius hierarchy?
+
+- Outer containers should have larger radii than inner elements
+- Nested elements should respect the scale ordering
+
+### 5. Confusion Signals
+
+- Did the LLM hedge about which radius to use?
+- Did the LLM explain its radius choice or seem unsure?
+- Did the LLM mix naming schemes?
+
+## Output
+
+Return JSON:
+
+```json
+{
+ "success": true/false,
+ "componentsUsed": ["XDSCard", ...],
+ "componentsExpected": ["XDSCard", ...],
+ "radiusTokensUsed": ["--radius-container", ...],
+ "radiusSelectionCorrect": true/false,
+ "radiusSelectionDetail": "Correctly used container radius for card, element radius for button",
+ "escapeHatches": [...],
+ "failureMode": null,
+ "confusionSignals": [],
+ "radiusHierarchyCorrect": true/false,
+ "radiusHierarchyDetail": "Outer card uses 12px, inner button uses 8px — correct ordering"
+}
+```
+
+### Escape Hatch Types (radius-specific)
+
+- `hallucination` — Used a radius token that doesn't exist in the tested scheme
+- `wrong_radius_level` — Used a token that exists but is the wrong level for the element
+- `hardcoded_radius` — Used raw pixel values instead of radius tokens
+- `redundant_css` — Applied border-radius CSS when the component already handles it
+- `mixed_naming` — Mixed semantic and numeric token names in the same code
+
+### Success Criteria
+
+**Success = correct radius tokens used for the right elements + no critical escape hatches**
+
+A response is successful even with acceptable escape hatches (supplemental_css, wrapper_div).
diff --git a/internal/vibe-tests/scripts/run-radius-ab-test.sh b/internal/vibe-tests/scripts/run-radius-ab-test.sh
new file mode 100755
index 0000000000..bccc0c9323
--- /dev/null
+++ b/internal/vibe-tests/scripts/run-radius-ab-test.sh
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+# @file Run radius token naming A/B vibe test
+# @position internal/vibe-tests/scripts/run-radius-ab-test.sh
+#
+# Runs two iterations of the radius-tokens test set:
+# 1. "semantic" — current naming (--radius-container, --radius-element, etc.)
+# 2. "numeric" — proposed naming (--radius-1, --radius-2, --radius-3, etc.)
+#
+# After both complete, compare results with:
+# yarn workspace @xds/vibe-tests compare --iterations <id-A>,<id-B>
+
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+VIBE_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
+
+echo "=== Radius Token Naming A/B Test ==="
+echo ""
+echo "This sets up two iterations for comparison:"
+echo " A) Semantic names (--radius-container, --radius-element, etc.)"
+echo " B) Numeric scale (--radius-1, --radius-2, --radius-3, etc.)"
+echo ""
+
+# Generate fresh skill doc from current source
+echo "Step 1: Generating skill docs..."
+bash "$SCRIPT_DIR/generate-skill-doc.sh"
+
+echo ""
+echo "Step 2: Setting up iteration A (semantic radius tokens)..."
+cd "$VIBE_DIR"
+npx tsx src/interactive.ts \
+ --test-set radius-tokens \
+ --label "radius-semantic" \
+ --skill-doc .generated/xds-skill-radius-semantic.md
+
+echo ""
+echo "Step 3: Setting up iteration B (numeric radius tokens)..."
+npx tsx src/interactive.ts \
+ --test-set radius-tokens \
+ --label "radius-numeric" \
+ --skill-doc .generated/xds-skill-radius-numeric.md
+
+echo ""
+echo "=== Setup complete ==="
+echo ""
+echo "Next steps:"
+echo " 1. Run each iteration's tests with subagents (see task manifests above)"
+echo " 2. After both complete, aggregate and compare results"
diff --git a/internal/vibe-tests/src/interactive.ts b/internal/vibe-tests/src/interactive.ts
index 8634cb5759..39f99775bf 100644
--- a/internal/vibe-tests/src/interactive.ts
+++ b/internal/vibe-tests/src/interactive.ts
@@ -911,6 +911,7 @@ function createTaskManifest(
prompts: TestPrompt[],
config: InteractiveConfig,
iterationId: string,
+ options?: {skillDocOverride?: string; label?: string},
): void {
const resultsDir = path.join(getResultsDir(), iterationId);
ensureDir(resultsDir);
@@ -919,6 +920,10 @@ function createTaskManifest(
iterationId,
createdAt: timestamp(),
config,
+ ...(options?.label && {label: options.label}),
+ ...(options?.skillDocOverride && {
+ skillDocOverride: options.skillDocOverride,
+ }),
prompts: prompts.map(p => ({
id: p.id,
category: p.category,
@@ -1108,6 +1113,13 @@ async function main() {
const promptsIndex = args.indexOf('--prompts');
const promptIds =
promptsIndex !== -1 ? args[promptsIndex + 1].split(',') : undefined;
+ const testSetIndex = args.indexOf('--test-set');
+ const testSetName = testSetIndex !== -1 ? args[testSetIndex + 1] : 'default';
+ const skillDocIndex = args.indexOf('--skill-doc');
+ const skillDocOverride =
+ skillDocIndex !== -1 ? args[skillDocIndex + 1] : undefined;
+ const labelIndex = args.indexOf('--label');
+ const label = labelIndex !== -1 ? args[labelIndex + 1] : undefined;
const config: InteractiveConfig = {
sample,
@@ -1129,7 +1141,23 @@ async function main() {
}
// Load test set
- const testSetPath = path.join(__dirname, '..', 'test-sets', 'default.json');
+ const testSetPath = path.join(
+ __dirname,
+ '..',
+ 'test-sets',
+ `${testSetName}.json`,
+ );
+ if (!fs.existsSync(testSetPath)) {
+ console.error(`Error: Test set not found at ${testSetPath}`);
+ console.error(
+ `Available test sets: ${fs
+ .readdirSync(path.join(__dirname, '..', 'test-sets'))
+ .filter(f => f.endsWith('.json'))
+ .map(f => f.replace('.json', ''))
+ .join(', ')}`,
+ );
+ process.exit(1);
+ }
const testSet = readJson<{prompts: TestPrompt[]; holdout?: TestPrompt[]}>(
testSetPath,
);
@@ -1158,8 +1186,11 @@ async function main() {
console.log(`\n🧪 Interactive Vibe Test Setup`);
console.log(`================================`);
console.log(`Iteration: ${iterationId}`);
+ if (label) console.log(`Label: ${label}`);
+ console.log(`Test set: ${testSetName}`);
console.log(`Target: ${target.toUpperCase()}`);
console.log(`Persona: ${persona}`);
+ if (skillDocOverride) console.log(`Skill doc: ${skillDocOverride}`);
console.log(
`Mode: ${target === 'xds' ? 'AGENTS.md' : target === 'baseline' ? 'AGENTS.baseline.md' : target === 'xds-tailwind' ? 'AGENTS.xds-tailwind.md' : 'AGENTS.html.md'} (retrieval-led)`,
);
@@ -1171,7 +1202,10 @@ async function main() {
);
// Create task manifest
- createTaskManifest(prompts, config, iterationId);
+ createTaskManifest(prompts, config, iterationId, {
+ skillDocOverride,
+ label,
+ });
// Output instructions
console.log(generateSubagentInstructions(iterationId, prompts, config));
diff --git a/internal/vibe-tests/test-sets/radius-tokens.json b/internal/vibe-tests/test-sets/radius-tokens.json
new file mode 100644
index 0000000000..3d787e276c
--- /dev/null
+++ b/internal/vibe-tests/test-sets/radius-tokens.json
@@ -0,0 +1,174 @@
+{
+ "name": "radius-tokens",
+ "description": "Focused test set for evaluating radius token naming: semantic (--radius-container) vs numeric scale (--radius-1 through --radius-4). Tests whether LLMs correctly select and apply radius tokens.",
+ "prompts": [
+ {
+ "id": "rad-1",
+ "category": "radius-selection",
+ "prompt": "Create a card component with rounded corners that contains a button. The card should have appropriate border radius for a container, and the button should have a smaller radius.",
+ "expectedComponents": [
+ "XDSCard",
+ "XDSButton"
+ ],
+ "complexity": "simple",
+ "followUps": [
+ "Now make the card corners sharper \u2014 use a smaller radius",
+ "Add a badge inside the card that uses a pill-shaped radius"
+ ]
+ },
+ {
+ "id": "rad-2",
+ "category": "radius-selection",
+ "prompt": "Build a modal dialog with rounded corners. Inside it, put a text input and a code block. The dialog should have container-level rounding, the input should have element-level rounding, and the code block should have subtle content-level rounding.",
+ "expectedComponents": [
+ "XDSDialog",
+ "XDSTextInput"
+ ],
+ "complexity": "moderate",
+ "followUps": [
+ "Add a dropdown menu inside the dialog \u2014 what radius should it use?",
+ "Make the dialog corners match a card's corners"
+ ]
+ },
+ {
+ "id": "rad-3",
+ "category": "radius-theming",
+ "prompt": "Create a custom theme that makes all corners sharper \u2014 reduce all border radii. Use the XDS theme system with defineTheme.",
+ "expectedComponents": [
+ "XDSTheme"
+ ],
+ "complexity": "moderate",
+ "followUps": [
+ "Now create a 'rounded' theme variant that increases all radii",
+ "Create a brutalist variant with zero border radius everywhere"
+ ]
+ },
+ {
+ "id": "rad-4",
+ "category": "radius-theming",
+ "prompt": "I want to create a theme where cards have 16px border radius, buttons have 8px, and small elements like code blocks have 4px. Set this up with defineTheme.",
+ "expectedComponents": [
+ "XDSTheme"
+ ],
+ "complexity": "simple",
+ "followUps": [
+ "Also make badges fully rounded (pill shape) in this theme",
+ "Add a version of this theme with doubled radii for a softer look"
+ ]
+ },
+ {
+ "id": "rad-5",
+ "category": "radius-composition",
+ "prompt": "Build a pricing card that has a header section, a body with a list of features, and a footer with a CTA button. Apply appropriate border radius at each nesting level \u2014 the outer card should have the largest radius, and inner elements should have progressively smaller radii.",
+ "expectedComponents": [
+ "XDSCard",
+ "XDSButton",
+ "XDSVStack"
+ ],
+ "complexity": "moderate",
+ "followUps": [
+ "The inner content corners look too sharp relative to the outer card. How do I calculate the right inner radius?",
+ "Apply concentric radius: inner radius = outer radius - padding"
+ ]
+ },
+ {
+ "id": "rad-6",
+ "category": "radius-composition",
+ "prompt": "Create a nested layout: a page section with large rounded corners contains a card with medium rounded corners, which contains a form with inputs that have small rounded corners. Use CSS variables for the radius values.",
+ "expectedComponents": [
+ "XDSCard",
+ "XDSTextInput"
+ ],
+ "complexity": "moderate",
+ "followUps": [
+ "The nested corners look off \u2014 the inner card's corners are too round relative to the outer section. Fix the visual harmony.",
+ "Use the formula innerRadius = max(0, outerRadius - padding) to fix it"
+ ]
+ },
+ {
+ "id": "rad-7",
+ "category": "radius-selection",
+ "prompt": "Build a notification toast that appears in the corner of the screen. It should have a dismiss button and an icon. What border radius should the toast use?",
+ "expectedComponents": [
+ "XDSCard",
+ "XDSButton"
+ ],
+ "complexity": "simple",
+ "followUps": [
+ "Add a progress bar at the bottom of the toast \u2014 what radius should it have?",
+ "Make the toast use the same radius as a dropdown menu"
+ ]
+ },
+ {
+ "id": "rad-8",
+ "category": "radius-selection",
+ "prompt": "Create a user avatar component that's circular, a status badge that's pill-shaped, and a tooltip that has subtle rounding. Use the appropriate radius tokens for each.",
+ "expectedComponents": [
+ "XDSAvatar",
+ "XDSBadge",
+ "XDSTooltip"
+ ],
+ "complexity": "simple",
+ "followUps": [
+ "Add a card below the avatar that contains user info \u2014 what radius should it use?",
+ "What's the difference between the radius token for the tooltip vs the card?"
+ ]
+ },
+ {
+ "id": "rad-9",
+ "category": "radius-theming",
+ "prompt": "Build a theme switcher that lets users choose between three radius styles: 'Sharp' (no rounding), 'Default' (standard rounding), and 'Soft' (extra rounding). Each option should preview how cards and buttons look.",
+ "expectedComponents": [
+ "XDSTheme",
+ "XDSCard",
+ "XDSButton"
+ ],
+ "complexity": "complex",
+ "followUps": [
+ "How would you implement this with a radius multiplier instead of overriding each token individually?",
+ "Add a slider that lets users set a custom radius multiplier from 0 to 2"
+ ]
+ },
+ {
+ "id": "rad-10",
+ "category": "radius-composition",
+ "prompt": "Create a dropdown menu that appears below a button. The dropdown should have the same border radius as cards/modals. Inside the dropdown, each menu item should have subtle rounding on hover.",
+ "expectedComponents": [
+ "XDSDropdownMenu",
+ "XDSButton"
+ ],
+ "complexity": "simple",
+ "followUps": [
+ "Group menu items into sections with a divider \u2014 should the divider have any radius?",
+ "The first and last items should have slightly more rounding to match the container's corners"
+ ]
+ },
+ {
+ "id": "rad-11",
+ "category": "radius-theming",
+ "prompt": "I'm using the XDS theme but I want to override just the radius tokens. Create a theme that keeps all default colors and spacing but makes corners more rounded \u2014 specifically, I want container-level elements to have 16px radius and interactive elements to have 12px radius.",
+ "expectedComponents": [
+ "XDSTheme"
+ ],
+ "complexity": "simple",
+ "followUps": [
+ "Also override the small/content radius to 8px",
+ "Now create a second theme variant where all these values are halved"
+ ]
+ },
+ {
+ "id": "rad-12",
+ "category": "radius-selection",
+ "prompt": "Build a table with rounded outer corners but sharp inner cell borders. The table container should have container-level rounding, but cells should have no border radius.",
+ "expectedComponents": [
+ "XDSTable",
+ "XDSCard"
+ ],
+ "complexity": "moderate",
+ "followUps": [
+ "Add a header row that matches the table's top corners",
+ "What radius token represents 'no rounding'?"
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/packages/cli/docs/principles.doc.mjs b/packages/cli/docs/principles.doc.mjs
index bb7911be72..5511d77359 100644
--- a/packages/cli/docs/principles.doc.mjs
+++ b/packages/cli/docs/principles.doc.mjs
@@ -98,7 +98,7 @@ const styles = stylex.create({
container: {
padding: 'var(--spacing-4)',
backgroundColor: 'var(--color-surface)',
- borderRadius: 'var(--radius-element)',
+ borderRadius: 'var(--radius-2)',
},
});
diff --git a/packages/cli/docs/principles.md b/packages/cli/docs/principles.md
index 55d030467b..dd1f7f522c 100644
--- a/packages/cli/docs/principles.md
+++ b/packages/cli/docs/principles.md
@@ -67,7 +67,7 @@ const styles = stylex.create({
container: {
padding: 'var(--spacing-4)',
backgroundColor: 'var(--color-surface)',
- borderRadius: 'var(--radius-element)',
+ borderRadius: 'var(--radius-2)',
},
});
diff --git a/packages/cli/docs/tokens.doc.mjs b/packages/cli/docs/tokens.doc.mjs
index e7082da912..d2d3843c62 100644
--- a/packages/cli/docs/tokens.doc.mjs
+++ b/packages/cli/docs/tokens.doc.mjs
@@ -101,10 +101,10 @@ export const docs = {
headers: ['Token', 'Value', 'Usage'],
rows: [
['--radius-rounded', '9999px', 'Pills, avatars'],
- ['--radius-container', '12px', 'Cards, modals'],
- ['--radius-element', '8px', 'Buttons, inputs'],
- ['--radius-content', '4px', 'Small elements'],
- ['--radius-inner', '0px', 'No radius'],
+ ['--radius-3', '12px', 'Cards, modals'],
+ ['--radius-2', '8px', 'Buttons, inputs'],
+ ['--radius-1', '4px', 'Small elements'],
+ ['--radius-0', '0px', 'No radius'],
],
},
],
@@ -190,7 +190,7 @@ const styles = stylex.create({
card: {
padding: spacingVars['--spacing-4'],
backgroundColor: colorVars['--color-surface'],
- borderRadius: radiusVars['--radius-container'],
+ borderRadius: radiusVars['--radius-3'],
},
button: {
height: sizeVars['--size-md'],
@@ -205,7 +205,7 @@ const styles = stylex.create({
card: {
padding: 'var(--spacing-4)',
backgroundColor: 'var(--color-surface)',
- borderRadius: 'var(--radius-container)',
+ borderRadius: 'var(--radius-3)',
},
});`,
},
diff --git a/packages/cli/docs/tokens.md b/packages/cli/docs/tokens.md
index 0c3ed35a30..747923238a 100644
--- a/packages/cli/docs/tokens.md
+++ b/packages/cli/docs/tokens.md
@@ -65,13 +65,13 @@ Control heights for consistent sizing across buttons, inputs, and selectors.
## Radius Tokens
-| Token | Value | Usage |
-| ------------------ | ------ | --------------- |
-| --radius-rounded | 9999px | Pills, avatars |
-| --radius-container | 12px | Cards, modals |
-| --radius-element | 8px | Buttons, inputs |
-| --radius-content | 4px | Small elements |
-| --radius-inner | 0px | No radius |
+| Token | Value | Usage |
+| ---------------- | ------ | --------------- |
+| --radius-rounded | 9999px | Pills, avatars |
+| --radius-3 | 12px | Cards, modals |
+| --radius-2 | 8px | Buttons, inputs |
+| --radius-1 | 4px | Small elements |
+| --radius-0 | 0px | No radius |
## Elevation Tokens
@@ -116,13 +116,13 @@ Control heights for consistent sizing across buttons, inputs, and selectors.
### Line Heights (Leading)
-| Token | Value | Usage |
-| ---------------- | ------ | ---------------------------- |
-| --leading-tight | 1.25 | Display text, headings |
-| --leading-snug | 1.375 | Compact body text, headings |
-| --leading-base | 1.4286 | Body text with --text-base |
-| --leading-normal | 1.5 | Body text, large body |
-| --leading-relaxed| 1.625 | Editorial body, reading text |
+| Token | Value | Usage |
+| ----------------- | ------ | ---------------------------- |
+| --leading-tight | 1.25 | Display text, headings |
+| --leading-snug | 1.375 | Compact body text, headings |
+| --leading-base | 1.4286 | Body text with --text-base |
+| --leading-normal | 1.5 | Body text, large body |
+| --leading-relaxed | 1.625 | Editorial body, reading text |
## Usage in StyleX
@@ -134,7 +134,7 @@ const styles = stylex.create({
card: {
padding: spacingVars['--spacing-4'],
backgroundColor: colorVars['--color-surface'],
- borderRadius: radiusVars['--radius-container'],
+ borderRadius: radiusVars['--radius-3'],
},
button: {
height: sizeVars['--size-md'],
@@ -149,7 +149,7 @@ const styles = stylex.create({
card: {
padding: 'var(--spacing-4)',
backgroundColor: 'var(--color-surface)',
- borderRadius: 'var(--radius-container)',
+ borderRadius: 'var(--radius-3)',
},
});
```
diff --git a/packages/cli/src/commands/build-theme.mjs b/packages/cli/src/commands/build-theme.mjs
index 6b1ada0b9d..b570041cce 100644
--- a/packages/cli/src/commands/build-theme.mjs
+++ b/packages/cli/src/commands/build-theme.mjs
@@ -296,10 +296,10 @@ function generateTailwindPreset(themeDef) {
}
// Radius
- borderRadius['element'] = 'var(--radius-element)';
- borderRadius['container'] = 'var(--radius-container)';
- borderRadius['content'] = 'var(--radius-content)';
- borderRadius['inner'] = 'var(--radius-inner)';
+ borderRadius['2'] = 'var(--radius-2)';
+ borderRadius['3'] = 'var(--radius-3)';
+ borderRadius['1'] = 'var(--radius-1)';
+ borderRadius['0'] = 'var(--radius-0)';
borderRadius['rounded'] = 'var(--radius-rounded)';
// Font size
diff --git a/packages/cli/src/commands/theme.mjs b/packages/cli/src/commands/theme.mjs
index 00a3219687..60551030e1 100644
--- a/packages/cli/src/commands/theme.mjs
+++ b/packages/cli/src/commands/theme.mjs
@@ -232,7 +232,7 @@ function generateThemeFile({name, exportName, colors, includeComponentOverrides,
// --- Card ---
// const cardOverrides = stylex.create({
// container: {
-// borderRadius: radiusVars['--radius-container'],
+// borderRadius: radiusVars['--radius-3'],
// // gradient border: set a gradient background + padding, inner content covers it
// // background: 'linear-gradient(135deg, ...)',
// },
@@ -327,7 +327,7 @@ const colorTheme = stylex.createTheme(
// Uncomment and customize to override other token groups:
// import { radiusVars, elevationVars, typographyVars, ... } from '@xds/core/theme/tokens.stylex';
-// const radiusTheme = stylex.createTheme(radiusVars, { '--radius-container': '16px', ... });
+// const radiusTheme = stylex.createTheme(radiusVars, { '--radius-3': '16px', ... });
${componentOverrideSection}
// =============================================================================
// Theme Export
diff --git a/packages/cli/templates/login/page.tsx b/packages/cli/templates/login/page.tsx
index 4c35ec0aff..a56adc2892 100644
--- a/packages/cli/templates/login/page.tsx
+++ b/packages/cli/templates/login/page.tsx
@@ -20,7 +20,7 @@ const styles = stylex.create({
maxWidth: '400px',
padding: 'var(--spacing-7)',
backgroundColor: 'var(--color-surface)',
- borderRadius: 'var(--radius-container)',
+ borderRadius: 'var(--radius-3)',
boxShadow: 'var(--elevation-menu)',
},
});
diff --git a/packages/core/src/AppShell/XDSAppShell.tsx b/packages/core/src/AppShell/XDSAppShell.tsx
index 95cb948a2d..c72f9331a7 100644
--- a/packages/core/src/AppShell/XDSAppShell.tsx
+++ b/packages/core/src/AppShell/XDSAppShell.tsx
@@ -312,7 +312,7 @@ const styles = stylex.create({
position: 'absolute',
inset: 0,
backgroundColor: colorVars['--color-surface'],
- borderStartStartRadius: radiusVars['--radius-page'],
+ borderStartStartRadius: radiusVars['--radius-4'],
pointerEvents: 'none',
},
elevatedContentWrapper: {
diff --git a/packages/core/src/Banner/XDSBanner.tsx b/packages/core/src/Banner/XDSBanner.tsx
index 24206c1651..efdb65372e 100644
--- a/packages/core/src/Banner/XDSBanner.tsx
+++ b/packages/core/src/Banner/XDSBanner.tsx
@@ -190,7 +190,7 @@ const styles = stylex.create({
overflow: 'clip',
},
card: {
- borderRadius: radiusVars['--radius-container'],
+ borderRadius: radiusVars['--radius-3'],
},
section: {
borderRadius: '0',
@@ -265,8 +265,8 @@ const styles = stylex.create({
borderBottomColor: colorVars['--color-divider'],
},
contentAreaCard: {
- borderBottomLeftRadius: radiusVars['--radius-container'],
- borderBottomRightRadius: radiusVars['--radius-container'],
+ borderBottomLeftRadius: radiusVars['--radius-3'],
+ borderBottomRightRadius: radiusVars['--radius-3'],
},
});
diff --git a/packages/core/src/Button/XDSButton.tsx b/packages/core/src/Button/XDSButton.tsx
index 7cf9e74caa..5ed901130f 100644
--- a/packages/core/src/Button/XDSButton.tsx
+++ b/packages/core/src/Button/XDSButton.tsx
@@ -51,7 +51,7 @@ const styles = stylex.create({
paddingInline: spacingVars['--spacing-3'],
borderWidth: 0,
borderStyle: 'none',
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
fontFamily: 'inherit',
fontSize: textSizeVars['--text-base'],
lineHeight: lineHeightVars['--leading-base'],
diff --git a/packages/core/src/Card/XDSCard.tsx b/packages/core/src/Card/XDSCard.tsx
index 54bb73122a..4767c784b5 100644
--- a/packages/core/src/Card/XDSCard.tsx
+++ b/packages/core/src/Card/XDSCard.tsx
@@ -30,7 +30,7 @@ const styles = stylex.create({
// Outer wrapper: visual styling with clip for border-radius
cardOuter: {
backgroundColor: colorVars['--color-card'],
- borderRadius: radiusVars['--radius-container'],
+ borderRadius: radiusVars['--radius-3'],
boxShadow: elevationVars['--elevation-base'],
// Clip content to border-radius so nested containers don\'t peek out corners
overflow: 'clip',
diff --git a/packages/core/src/CheckboxInput/XDSCheckboxInput.tsx b/packages/core/src/CheckboxInput/XDSCheckboxInput.tsx
index 08de0a5ada..747195aa16 100644
--- a/packages/core/src/CheckboxInput/XDSCheckboxInput.tsx
+++ b/packages/core/src/CheckboxInput/XDSCheckboxInput.tsx
@@ -69,7 +69,7 @@ const styles = stylex.create({
justifyContent: 'center',
borderWidth: 1,
borderStyle: 'solid',
- borderRadius: radiusVars['--radius-content'],
+ borderRadius: radiusVars['--radius-1'],
transitionProperty: 'background-color, border-color',
transitionDuration: transitionVars['--transition-fast'],
},
diff --git a/packages/core/src/DateInput/XDSDateInput.tsx b/packages/core/src/DateInput/XDSDateInput.tsx
index 597e07dfd0..a311a7436e 100644
--- a/packages/core/src/DateInput/XDSDateInput.tsx
+++ b/packages/core/src/DateInput/XDSDateInput.tsx
@@ -63,7 +63,7 @@ const styles = stylex.create({
borderStyle: 'none',
backgroundColor: 'transparent',
cursor: 'pointer',
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
outline: {
default: 'none',
':focus-visible': `1px solid ${colorVars['--color-focus-outline']}`,
@@ -98,7 +98,7 @@ const styles = stylex.create({
},
popover: {
backgroundColor: colorVars['--color-popover'],
- borderRadius: radiusVars['--radius-container'],
+ borderRadius: radiusVars['--radius-3'],
boxShadow: elevationVars['--elevation-menu'],
},
});
diff --git a/packages/core/src/Dialog/XDSDialog.tsx b/packages/core/src/Dialog/XDSDialog.tsx
index cd4e15747c..ca43f301af 100644
--- a/packages/core/src/Dialog/XDSDialog.tsx
+++ b/packages/core/src/Dialog/XDSDialog.tsx
@@ -60,7 +60,7 @@ const styles = stylex.create({
padding: 0,
border: 'none',
backgroundColor: colorVars['--color-surface'],
- borderRadius: radiusVars['--radius-container'],
+ borderRadius: radiusVars['--radius-3'],
boxShadow: elevationVars['--elevation-dialog'],
display: {
default: 'none',
diff --git a/packages/core/src/DropdownMenu/XDSDropdownMenu.tsx b/packages/core/src/DropdownMenu/XDSDropdownMenu.tsx
index 3df3c157cb..de70a6d0b9 100644
--- a/packages/core/src/DropdownMenu/XDSDropdownMenu.tsx
+++ b/packages/core/src/DropdownMenu/XDSDropdownMenu.tsx
@@ -47,7 +47,7 @@ const styles = stylex.create({
maxHeight: '300px',
overflowY: 'auto',
padding: spacingVars['--spacing-1'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
backgroundColor: colorVars['--color-surface'],
boxShadow: elevationVars['--elevation-menu'],
opacity: 1,
@@ -88,7 +88,7 @@ const styles = stylex.create({
gap: spacingVars['--spacing-2'],
width: '100%',
padding: spacingVars['--spacing-2'],
- borderRadius: radiusVars['--radius-content'],
+ borderRadius: radiusVars['--radius-1'],
fontFamily: typographyVars['--font-body'],
fontSize: textSizeVars['--text-base'],
color: colorVars['--color-text-primary'],
diff --git a/packages/core/src/Field/XDSFieldStatus.tsx b/packages/core/src/Field/XDSFieldStatus.tsx
index c670bf55b8..fb06fc7552 100644
--- a/packages/core/src/Field/XDSFieldStatus.tsx
+++ b/packages/core/src/Field/XDSFieldStatus.tsx
@@ -32,14 +32,14 @@ const styles = stylex.create({
paddingBlockStart: 14,
paddingBlockEnd: 8,
paddingInline: spacingVars['--spacing-2'],
- borderBottomLeftRadius: radiusVars['--radius-element'],
- borderBottomRightRadius: radiusVars['--radius-element'],
+ borderBottomLeftRadius: radiusVars['--radius-2'],
+ borderBottomRightRadius: radiusVars['--radius-2'],
},
detached: {
marginTop: spacingVars['--spacing-1'],
paddingBlock: spacingVars['--spacing-2'],
paddingInline: spacingVars['--spacing-2'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
},
});
diff --git a/packages/core/src/Field/inputStyles.stylex.ts b/packages/core/src/Field/inputStyles.stylex.ts
index ac4bc12a32..51894021a8 100644
--- a/packages/core/src/Field/inputStyles.stylex.ts
+++ b/packages/core/src/Field/inputStyles.stylex.ts
@@ -42,7 +42,7 @@ export const inputWrapperStyles = stylex.create({
'@media (hover: hover)': colorVars['--color-divider-high-contrast'],
},
},
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
backgroundColor: colorVars['--color-surface'],
transitionProperty: 'border-color, outline, box-shadow',
transitionDuration: transitionVars['--transition-fast'],
diff --git a/packages/core/src/HoverCard/useXDSHoverCard.tsx b/packages/core/src/HoverCard/useXDSHoverCard.tsx
index dbe967470b..3aef8ef44e 100644
--- a/packages/core/src/HoverCard/useXDSHoverCard.tsx
+++ b/packages/core/src/HoverCard/useXDSHoverCard.tsx
@@ -35,7 +35,7 @@ const styles = stylex.create({
// Base container styles passed to useXDSLayer (includes animations)
container: {
backgroundColor: colorVars['--color-surface'],
- borderRadius: radiusVars['--radius-container'],
+ borderRadius: radiusVars['--radius-3'],
boxShadow: elevationVars['--elevation-hover'],
// Animation: closed state (default) and open state
opacity: {
diff --git a/packages/core/src/Kbd/XDSKbd.tsx b/packages/core/src/Kbd/XDSKbd.tsx
index dd2eb609fd..3e0ef4c773 100644
--- a/packages/core/src/Kbd/XDSKbd.tsx
+++ b/packages/core/src/Kbd/XDSKbd.tsx
@@ -36,7 +36,7 @@ const styles = stylex.create({
minWidth: '20px',
height: '20px',
paddingInline: spacingVars['--spacing-1'],
- borderRadius: radiusVars['--radius-content'],
+ borderRadius: radiusVars['--radius-1'],
backgroundColor: colorVars['--color-wash'],
borderBottomWidth: '2px',
borderBottomStyle: 'solid',
diff --git a/packages/core/src/List/XDSListItem.tsx b/packages/core/src/List/XDSListItem.tsx
index 8a5a850b1b..8bbafc2949 100644
--- a/packages/core/src/List/XDSListItem.tsx
+++ b/packages/core/src/List/XDSListItem.tsx
@@ -141,7 +141,7 @@ const styles = stylex.create({
gap: spacingVars['--spacing-3'],
},
withRadius: {
- borderRadius: radiusVars['--radius-content'],
+ borderRadius: radiusVars['--radius-1'],
},
noRadius: {
borderRadius: 0,
diff --git a/packages/core/src/MoreMenu/XDSMoreMenu.tsx b/packages/core/src/MoreMenu/XDSMoreMenu.tsx
index d41f231fa0..f4473bf30b 100644
--- a/packages/core/src/MoreMenu/XDSMoreMenu.tsx
+++ b/packages/core/src/MoreMenu/XDSMoreMenu.tsx
@@ -56,7 +56,7 @@ const styles = stylex.create({
maxHeight: '300px',
overflowY: 'auto',
padding: spacingVars['--spacing-1'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
backgroundColor: colorVars['--color-surface'],
boxShadow: `0 4px 12px ${colorVars['--color-shadow-elevation']}`,
opacity: 1,
@@ -82,7 +82,7 @@ const styles = stylex.create({
gap: spacingVars['--spacing-2'],
width: '100%',
padding: spacingVars['--spacing-2'],
- borderRadius: radiusVars['--radius-content'],
+ borderRadius: radiusVars['--radius-1'],
fontFamily: typographyVars['--font-body'],
fontSize: textSizeVars['--text-base'],
color: colorVars['--color-text-primary'],
diff --git a/packages/core/src/NavItem/navItemStyles.stylex.ts b/packages/core/src/NavItem/navItemStyles.stylex.ts
index abcb79324c..27fb7cb6a4 100644
--- a/packages/core/src/NavItem/navItemStyles.stylex.ts
+++ b/packages/core/src/NavItem/navItemStyles.stylex.ts
@@ -49,7 +49,7 @@ export const navItemStyles = stylex.create({
width: '100%',
paddingInline: spacingVars['--spacing-2'],
paddingBlock: spacingVars['--spacing-2'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
borderWidth: 0,
borderStyle: 'none',
backgroundColor: 'transparent',
diff --git a/packages/core/src/Popover/XDSPopover.tsx b/packages/core/src/Popover/XDSPopover.tsx
index efcfea7609..4266be588b 100644
--- a/packages/core/src/Popover/XDSPopover.tsx
+++ b/packages/core/src/Popover/XDSPopover.tsx
@@ -192,7 +192,7 @@ const styles = stylex.create({
container: {
backgroundColor: colorVars['--color-surface'],
color: colorVars['--color-text-primary'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
boxShadow: elevationVars['--elevation-menu'],
},
contentPadding: {
diff --git a/packages/core/src/Popover/useXDSPopover.tsx b/packages/core/src/Popover/useXDSPopover.tsx
index cf2b8f56d7..844d4e191b 100644
--- a/packages/core/src/Popover/useXDSPopover.tsx
+++ b/packages/core/src/Popover/useXDSPopover.tsx
@@ -71,7 +71,7 @@ const styles = stylex.create({
backgroundColor: colorVars['--color-text-primary'],
color: colorVars['--color-surface'],
fontSize: textSizeVars['--text-sm'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
cursor: 'pointer',
borderWidth: 0,
borderStyle: 'none',
diff --git a/packages/core/src/PowerSearch/PowerSearchEditPopover.tsx b/packages/core/src/PowerSearch/PowerSearchEditPopover.tsx
index 07933bfe26..40aa341c00 100644
--- a/packages/core/src/PowerSearch/PowerSearchEditPopover.tsx
+++ b/packages/core/src/PowerSearch/PowerSearchEditPopover.tsx
@@ -36,7 +36,7 @@ import type {
const styles = stylex.create({
container: {
backgroundColor: colorVars['--color-surface'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
boxShadow: elevationVars['--elevation-menu'],
overflow: 'hidden',
},
diff --git a/packages/core/src/Selector/XDSSelector.tsx b/packages/core/src/Selector/XDSSelector.tsx
index 3fc2c7d860..a5dcd40085 100644
--- a/packages/core/src/Selector/XDSSelector.tsx
+++ b/packages/core/src/Selector/XDSSelector.tsx
@@ -75,7 +75,7 @@ const styles = stylex.create({
'@media (hover: hover)': colorVars['--color-divider-high-contrast'],
},
},
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
backgroundColor: colorVars['--color-surface'],
fontFamily: typographyVars['--font-body'],
fontSize: textSizeVars['--text-base'],
@@ -129,7 +129,7 @@ const styles = stylex.create({
maxHeight: '300px',
overflowY: 'auto',
padding: spacingVars['--spacing-1'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
backgroundColor: colorVars['--color-surface'],
boxShadow: `0 4px 12px ${colorVars['--color-shadow-elevation']}`,
opacity: 1,
@@ -167,7 +167,7 @@ const styles = stylex.create({
gap: spacingVars['--spacing-2'],
width: '100%',
padding: spacingVars['--spacing-2'],
- borderRadius: radiusVars['--radius-content'],
+ borderRadius: radiusVars['--radius-1'],
fontFamily: typographyVars['--font-body'],
fontSize: textSizeVars['--text-base'],
color: colorVars['--color-text-primary'],
diff --git a/packages/core/src/SideNav/XDSSideNavHeading.tsx b/packages/core/src/SideNav/XDSSideNavHeading.tsx
index 877c6739e0..f1706b1bcb 100644
--- a/packages/core/src/SideNav/XDSSideNavHeading.tsx
+++ b/packages/core/src/SideNav/XDSSideNavHeading.tsx
@@ -58,7 +58,7 @@ const styles = stylex.create({
},
interactive: {
cursor: 'pointer',
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
borderWidth: 0,
borderStyle: 'none',
backgroundColor: 'transparent',
@@ -128,7 +128,7 @@ const styles = stylex.create({
},
popoverContent: {
padding: spacingVars['--spacing-1'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
backgroundColor: colorVars['--color-surface'],
boxShadow: `0 4px 12px ${colorVars['--color-shadow-elevation']}`,
overflow: 'hidden',
diff --git a/packages/core/src/Skeleton/XDSSkeleton.tsx b/packages/core/src/Skeleton/XDSSkeleton.tsx
index 7a3e0a9dee..cd34bde626 100644
--- a/packages/core/src/Skeleton/XDSSkeleton.tsx
+++ b/packages/core/src/Skeleton/XDSSkeleton.tsx
@@ -71,23 +71,44 @@ const styles = stylex.create({
});
const radiusStyles = stylex.create({
+ // Numeric scale names (preferred)
none: {
borderRadius: 0,
},
+ 0: {
+ borderRadius: radiusVars['--radius-0'],
+ },
+ 1: {
+ borderRadius: radiusVars['--radius-1'],
+ },
+ 2: {
+ borderRadius: radiusVars['--radius-2'],
+ },
+ 3: {
+ borderRadius: radiusVars['--radius-3'],
+ },
+ 4: {
+ borderRadius: radiusVars['--radius-4'],
+ },
rounded: {
borderRadius: radiusVars['--radius-rounded'],
},
- container: {
- borderRadius: radiusVars['--radius-container'],
- },
- element: {
- borderRadius: radiusVars['--radius-element'],
+ // Deprecated semantic aliases (backwards compat)
+ /** @deprecated Use '0' instead */
+ inner: {
+ borderRadius: radiusVars['--radius-0'],
},
+ /** @deprecated Use '1' instead */
content: {
- borderRadius: radiusVars['--radius-content'],
+ borderRadius: radiusVars['--radius-1'],
},
- inner: {
- borderRadius: radiusVars['--radius-inner'],
+ /** @deprecated Use '2' instead */
+ element: {
+ borderRadius: radiusVars['--radius-2'],
+ },
+ /** @deprecated Use '3' instead */
+ container: {
+ borderRadius: radiusVars['--radius-3'],
},
});
@@ -127,13 +148,18 @@ export interface XDSSkeletonProps extends XDSBaseProps<HTMLDivElement> {
*/
height?: number | string;
/**
- * Border radius of the skeleton, using design token names.
+ * Border radius of the skeleton, using design token scale.
+ * Numeric names (preferred):
* - 'none': No border radius (sharp corners)
- * - 'inner': Inner radius
- * - 'content': Content radius
- * - 'element': Element radius
- * - 'container': Container radius (default)
+ * - 0: radius-0 token
+ * - 1: radius-1 token
+ * - 2: radius-2 token
+ * - 3: radius-3 token (default)
+ * - 4: radius-4 token
* - 'rounded': Fully rounded (for avatars, pills)
+ *
+ * Deprecated semantic aliases (still work):
+ * - 'inner' → 0, 'content' → 1, 'element' → 2, 'container' → 3
* @default 'container'
*/
radius?: XDSSkeletonRadius;
diff --git a/packages/core/src/TabList/XDSTab.tsx b/packages/core/src/TabList/XDSTab.tsx
index cf93e7a50e..71b1dc250a 100644
--- a/packages/core/src/TabList/XDSTab.tsx
+++ b/packages/core/src/TabList/XDSTab.tsx
@@ -74,7 +74,7 @@ const styles = stylex.create({
backgroundColor: 'transparent',
borderWidth: 0,
borderStyle: 'none',
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
fontFamily: 'inherit',
fontSize: textSizeVars['--text-base'],
lineHeight: lineHeightVars['--leading-base'],
diff --git a/packages/core/src/TabList/XDSTabMenu.tsx b/packages/core/src/TabList/XDSTabMenu.tsx
index 3b18e026df..82e4c02f10 100644
--- a/packages/core/src/TabList/XDSTabMenu.tsx
+++ b/packages/core/src/TabList/XDSTabMenu.tsx
@@ -69,7 +69,7 @@ const styles = stylex.create({
backgroundColor: 'transparent',
borderWidth: 0,
borderStyle: 'none',
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
fontFamily: 'inherit',
fontSize: textSizeVars['--text-base'],
lineHeight: lineHeightVars['--leading-base'],
@@ -156,7 +156,7 @@ const styles = stylex.create({
paddingBlock: spacingVars['--spacing-1'],
paddingInline: spacingVars['--spacing-1'],
backgroundColor: colorVars['--color-surface'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
boxShadow: elevationVars['--elevation-menu'],
minWidth: '160px',
},
@@ -167,7 +167,7 @@ const styles = stylex.create({
gap: spacingVars['--spacing-2'],
paddingBlock: spacingVars['--spacing-2'],
paddingInline: spacingVars['--spacing-3'],
- borderRadius: radiusVars['--radius-content'],
+ borderRadius: radiusVars['--radius-1'],
fontFamily: 'inherit',
fontSize: textSizeVars['--text-base'],
lineHeight: lineHeightVars['--leading-base'],
diff --git a/packages/core/src/TimeInput/XDSTimeInput.tsx b/packages/core/src/TimeInput/XDSTimeInput.tsx
index f81c08faa0..fdd26f7d0a 100644
--- a/packages/core/src/TimeInput/XDSTimeInput.tsx
+++ b/packages/core/src/TimeInput/XDSTimeInput.tsx
@@ -95,7 +95,7 @@ const styles = stylex.create({
borderStyle: 'none',
backgroundColor: 'transparent',
cursor: 'pointer',
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
outline: {
default: 'none',
':focus-visible': `1px solid ${colorVars['--color-focus-outline']}`,
diff --git a/packages/core/src/Token/XDSToken.tsx b/packages/core/src/Token/XDSToken.tsx
index dc90ead3c3..b6aaa57841 100644
--- a/packages/core/src/Token/XDSToken.tsx
+++ b/packages/core/src/Token/XDSToken.tsx
@@ -141,7 +141,7 @@ const styles = stylex.create({
paddingBlock: 0,
borderWidth: 0,
borderStyle: 'none',
- borderRadius: radiusVars['--radius-content'],
+ borderRadius: radiusVars['--radius-1'],
fontFamily: 'inherit',
fontSize: textSizeVars['--text-sm'],
lineHeight: lineHeightVars['--leading-snug'],
diff --git a/packages/core/src/Tooltip/useXDSTooltip.tsx b/packages/core/src/Tooltip/useXDSTooltip.tsx
index ca678ec284..2dadbaa561 100644
--- a/packages/core/src/Tooltip/useXDSTooltip.tsx
+++ b/packages/core/src/Tooltip/useXDSTooltip.tsx
@@ -38,7 +38,7 @@ const styles = stylex.create({
// Inverted color palette: dark background, light text
backgroundColor: colorVars['--color-text-primary'],
color: colorVars['--color-surface'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
// Typography
fontFamily: typographyVars['--font-body'],
fontSize: 14,
diff --git a/packages/core/src/TopNav/XDSTopNavItem.tsx b/packages/core/src/TopNav/XDSTopNavItem.tsx
index ed2697b78d..2f0c6c8854 100644
--- a/packages/core/src/TopNav/XDSTopNavItem.tsx
+++ b/packages/core/src/TopNav/XDSTopNavItem.tsx
@@ -41,7 +41,7 @@ const styles = stylex.create({
gap: spacingVars['--spacing-2'],
paddingBlock: spacingVars['--spacing-2'],
paddingInline: spacingVars['--spacing-3'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
fontSize: textSizeVars['--text-base'],
lineHeight: lineHeightVars['--leading-base'],
fontWeight: fontWeightVars['--font-weight-medium'],
diff --git a/packages/core/src/TopNav/XDSTopNavMegaMenu.tsx b/packages/core/src/TopNav/XDSTopNavMegaMenu.tsx
index 069934961c..e4ac2718f6 100644
--- a/packages/core/src/TopNav/XDSTopNavMegaMenu.tsx
+++ b/packages/core/src/TopNav/XDSTopNavMegaMenu.tsx
@@ -51,7 +51,7 @@ const styles = stylex.create({
gap: spacingVars['--spacing-2'],
paddingBlock: spacingVars['--spacing-2'],
paddingInline: spacingVars['--spacing-3'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
fontSize: textSizeVars['--text-base'],
lineHeight: lineHeightVars['--leading-base'],
fontWeight: fontWeightVars['--font-weight-medium'],
@@ -116,8 +116,8 @@ const styles = stylex.create({
borderTop: `1px solid ${colorVars['--color-divider']}`,
borderTopLeftRadius: 0,
borderTopRightRadius: 0,
- borderBottomLeftRadius: radiusVars['--radius-container'],
- borderBottomRightRadius: radiusVars['--radius-container'],
+ borderBottomLeftRadius: radiusVars['--radius-3'],
+ borderBottomRightRadius: radiusVars['--radius-3'],
boxShadow: elevationVars['--elevation-menu'],
overflow: 'hidden',
},
@@ -140,7 +140,7 @@ const styles = stylex.create({
flexGrow: 1,
flexShrink: 1,
flexBasis: 200,
- borderRadius: radiusVars['--radius-container'],
+ borderRadius: radiusVars['--radius-3'],
backgroundColor: colorVars['--color-deemphasized'],
overflow: 'hidden',
display: 'flex',
@@ -186,7 +186,7 @@ const styles = stylex.create({
drawerFeatured: {
marginBlockStart: spacingVars['--spacing-2'],
marginInlineStart: spacingVars['--spacing-6'],
- borderRadius: radiusVars['--radius-container'],
+ borderRadius: radiusVars['--radius-3'],
backgroundColor: colorVars['--color-deemphasized'],
overflow: 'hidden',
},
diff --git a/packages/core/src/TopNav/XDSTopNavMegaMenuItem.tsx b/packages/core/src/TopNav/XDSTopNavMegaMenuItem.tsx
index 3e728e1590..c88eaa232f 100644
--- a/packages/core/src/TopNav/XDSTopNavMegaMenuItem.tsx
+++ b/packages/core/src/TopNav/XDSTopNavMegaMenuItem.tsx
@@ -40,7 +40,7 @@ const styles = stylex.create({
gap: spacingVars['--spacing-3'],
paddingBlock: spacingVars['--spacing-3'],
paddingInline: spacingVars['--spacing-3'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
textDecoration: 'none',
cursor: 'pointer',
transitionProperty: 'background-color',
@@ -73,7 +73,7 @@ const styles = stylex.create({
justifyContent: 'center',
width: 40,
height: 40,
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
backgroundColor: colorVars['--color-deemphasized'],
flexShrink: 0,
color: colorVars['--color-icon-secondary'],
@@ -108,7 +108,7 @@ const styles = stylex.create({
justifyContent: 'center',
width: 32,
height: 32,
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
backgroundColor: colorVars['--color-deemphasized'],
flexShrink: 0,
color: colorVars['--color-icon-secondary'],
diff --git a/packages/core/src/TopNav/XDSTopNavMenu.tsx b/packages/core/src/TopNav/XDSTopNavMenu.tsx
index 326cf825b7..743ebb77f8 100644
--- a/packages/core/src/TopNav/XDSTopNavMenu.tsx
+++ b/packages/core/src/TopNav/XDSTopNavMenu.tsx
@@ -48,7 +48,7 @@ const styles = stylex.create({
gap: spacingVars['--spacing-2'],
paddingBlock: spacingVars['--spacing-2'],
paddingInline: spacingVars['--spacing-3'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
fontSize: textSizeVars['--text-base'],
lineHeight: lineHeightVars['--leading-base'],
fontWeight: fontWeightVars['--font-weight-medium'],
@@ -94,7 +94,7 @@ const styles = stylex.create({
minWidth: 280,
padding: spacingVars['--spacing-1'],
backgroundColor: colorVars['--color-popover'],
- borderRadius: radiusVars['--radius-container'],
+ borderRadius: radiusVars['--radius-3'],
boxShadow: elevationVars['--elevation-menu'],
},
menuOffset: {
@@ -107,7 +107,7 @@ const styles = stylex.create({
gap: spacingVars['--spacing-3'],
paddingBlock: spacingVars['--spacing-3'],
paddingInline: spacingVars['--spacing-3'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
textDecoration: 'none',
cursor: 'pointer',
transitionProperty: 'background-color',
@@ -134,7 +134,7 @@ const styles = stylex.create({
justifyContent: 'center',
width: 40,
height: 40,
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
backgroundColor: colorVars['--color-deemphasized'],
flexShrink: 0,
},
diff --git a/packages/core/src/TreeList/XDSTreeListItem.tsx b/packages/core/src/TreeList/XDSTreeListItem.tsx
index 99e3f1b6f3..2a1d968adf 100644
--- a/packages/core/src/TreeList/XDSTreeListItem.tsx
+++ b/packages/core/src/TreeList/XDSTreeListItem.tsx
@@ -61,7 +61,7 @@ const styles = stylex.create({
position: 'relative',
},
contentWrapper: {
- borderRadius: radiusVars['--radius-content'],
+ borderRadius: radiusVars['--radius-1'],
display: 'flex',
alignItems: 'center',
gap: spacingVars['--spacing-2'],
@@ -161,7 +161,7 @@ const styles = stylex.create({
background: 'none',
padding: 0,
color: colorVars['--color-icon-secondary'],
- borderRadius: radiusVars['--radius-content'],
+ borderRadius: radiusVars['--radius-1'],
},
chevronButton: {
all: 'unset',
@@ -173,7 +173,7 @@ const styles = stylex.create({
fontSize: CHEVRON_SIZE,
cursor: 'pointer',
color: colorVars['--color-icon-secondary'],
- borderRadius: radiusVars['--radius-content'],
+ borderRadius: radiusVars['--radius-1'],
},
chevronSvg: {
display: 'flex',
diff --git a/packages/core/src/Typeahead/XDSBaseTypeahead.tsx b/packages/core/src/Typeahead/XDSBaseTypeahead.tsx
index 7c9b1b0bf3..be981396ad 100644
--- a/packages/core/src/Typeahead/XDSBaseTypeahead.tsx
+++ b/packages/core/src/Typeahead/XDSBaseTypeahead.tsx
@@ -176,7 +176,7 @@ const styles = stylex.create({
maxHeight: '300px',
overflowY: 'auto',
padding: spacingVars['--spacing-1'],
- borderRadius: radiusVars['--radius-element'],
+ borderRadius: radiusVars['--radius-2'],
backgroundColor: colorVars['--color-surface'],
boxShadow: `0 4px 12px ${colorVars['--color-shadow-elevation']}`,
},
@@ -193,7 +193,7 @@ const styles = stylex.create({
alignItems: 'center',
width: '100%',
padding: spacingVars['--spacing-2'],
- borderRadius: radiusVars['--radius-content'],
+ borderRadius: radiusVars['--radius-1'],
cursor: 'pointer',
outline: 'none',
backgroundColor: 'transparent',
diff --git a/packages/core/src/theme/README.md b/packages/core/src/theme/README.md
index a4541de80b..839e59ccb3 100644
--- a/packages/core/src/theme/README.md
+++ b/packages/core/src/theme/README.md
@@ -124,7 +124,7 @@ const styles = stylex.create({
card: {
backgroundColor: 'var(--color-surface)',
padding: 'var(--spacing-4)',
- borderRadius: 'var(--radius-container)',
+ borderRadius: 'var(--radius-3)',
},
});
```
diff --git a/packages/core/src/theme/defineTheme.test.ts b/packages/core/src/theme/defineTheme.test.ts
index bd5f690962..ae7dcb94a2 100644
--- a/packages/core/src/theme/defineTheme.test.ts
+++ b/packages/core/src/theme/defineTheme.test.ts
@@ -35,10 +35,10 @@ describe('defineTheme', () => {
const theme = defineTheme({
name: 'string-test',
tokens: {
- '--radius-container': '16px',
+ '--radius-3': '16px',
},
});
- expect(theme.tokens['--radius-container']).toBe('16px');
+ expect(theme.tokens['--radius-3']).toBe('16px');
});
it('mixes tuples and strings', () => {
@@ -46,12 +46,12 @@ describe('defineTheme', () => {
name: 'mixed',
tokens: {
'--color-accent': ['#0077B6', '#48CAE4'],
- '--radius-container': '16px',
+ '--radius-3': '16px',
'--font-heading': '"Georgia", serif',
},
});
expect(theme.tokens['--color-accent']).toBe('light-dark(#0077B6, #48CAE4)');
- expect(theme.tokens['--radius-container']).toBe('16px');
+ expect(theme.tokens['--radius-3']).toBe('16px');
expect(theme.tokens['--font-heading']).toBe('"Georgia", serif');
});
@@ -89,13 +89,13 @@ describe('generateThemeCSS', () => {
name: 'ocean',
tokens: {
'--color-accent': ['#0077B6', '#48CAE4'],
- '--radius-container': '16px',
+ '--radius-3': '16px',
},
});
const css = generateThemeCSS(theme);
expect(css).toContain('@scope');
expect(css).toContain('--color-accent: light-dark(#0077B6, #48CAE4)');
- expect(css).toContain('--radius-container: 16px');
+ expect(css).toContain('--radius-3: 16px');
// :scope should NOT contain non-overridden tokens
expect(css).not.toContain('--color-surface:');
});
@@ -220,14 +220,14 @@ describe('generateThemeCSS with components', () => {
it('combines tokens and components', () => {
const theme = defineTheme({
name: 'combo',
- tokens: {'--radius-container': '20px'},
+ tokens: {'--radius-3': '20px'},
components: {
card: {base: {borderWidth: '1px'}},
},
});
const css = generateThemeCSS(theme);
expect(css).toContain('@scope');
- expect(css).toContain('--radius-container: 20px');
+ expect(css).toContain('--radius-3: 20px');
expect(css).toContain('.xds-card {');
expect(css).toContain('border-width: 1px');
});
@@ -370,3 +370,60 @@ describe('typeScale component auto-generation', () => {
);
});
});
+
+describe('radiusScale', () => {
+ it('generates radius tokens from radiusScale', () => {
+ const theme = defineTheme({
+ name: 'rounded',
+ radiusScale: {base: 4, multiplier: 1.5},
+ });
+ expect(theme.tokens['--radius-1']).toBe('6px');
+ expect(theme.tokens['--radius-2']).toBe('12px');
+ expect(theme.tokens['--radius-3']).toBe('18px');
+ expect(theme.tokens['--radius-4']).toBe('24px');
+ expect(theme.tokens['--radius-0']).toBe('0px');
+ expect(theme.tokens['--radius-rounded']).toBe('9999px');
+ });
+
+ it('explicit tokens override radiusScale', () => {
+ const theme = defineTheme({
+ name: 'custom',
+ radiusScale: {base: 4, multiplier: 1},
+ tokens: {'--radius-3': '20px'},
+ });
+ expect(theme.tokens['--radius-3']).toBe('20px');
+ expect(theme.tokens['--radius-2']).toBe('8px'); // from radiusScale
+ });
+
+ it('radiusScale with multiplier 0 produces sharp theme', () => {
+ const theme = defineTheme({
+ name: 'sharp',
+ radiusScale: {base: 4, multiplier: 0},
+ });
+ expect(theme.tokens['--radius-1']).toBe('0px');
+ expect(theme.tokens['--radius-2']).toBe('0px');
+ expect(theme.tokens['--radius-3']).toBe('0px');
+ expect(theme.tokens['--radius-4']).toBe('0px');
+ expect(theme.tokens['--radius-0']).toBe('0px');
+ expect(theme.tokens['--radius-rounded']).toBe('9999px');
+ });
+
+ it('works without radiusScale (backwards compatible)', () => {
+ const theme = defineTheme({name: 'no-scale'});
+ expect(theme.tokens['--radius-0']).toBeUndefined();
+ });
+
+ it('combines radiusScale with typeScale and other tokens', () => {
+ const theme = defineTheme({
+ name: 'combo',
+ typeScale: {base: 16, ratio: 1.25},
+ radiusScale: {base: 4, multiplier: 1},
+ tokens: {
+ '--color-accent': '#FF0000',
+ },
+ });
+ expect(theme.tokens['--color-accent']).toBe('#FF0000');
+ expect(theme.tokens['--heading-4-size']).toBe('1rem');
+ expect(theme.tokens['--radius-2']).toBe('8px');
+ });
+});
diff --git a/packages/core/src/theme/defineTheme.ts b/packages/core/src/theme/defineTheme.ts
index b46f4ea362..7b8a7cda56 100644
--- a/packages/core/src/theme/defineTheme.ts
+++ b/packages/core/src/theme/defineTheme.ts
@@ -17,7 +17,7 @@
* tokens: {
* '--color-accent': ['#0077B6', '#48CAE4'], // [light, dark]
* '--color-surface': ['#F0F8FF', '#0A1628'],
- * '--radius-container': '16px', // same in both modes
+ * '--radius-3': '16px', // same in both modes
* },
* icons: oceanIcons,
* });
@@ -48,6 +48,10 @@ import {
generateTypeScaleComponents,
type XDSTypeScaleConfig,
} from './expandTypeScale';
+import {
+ expandRadiusScale,
+ type XDSRadiusScaleConfig,
+} from './expandRadiusScale';
// =============================================================================
// Types
@@ -134,6 +138,25 @@ export interface XDSDefineThemeInput {
* ```
*/
typeScale?: XDSTypeScaleConfig;
+ /**
+ * Optional radius scale configuration. Generates radius token overrides
+ * from a base unit and multiplier.
+ *
+ * radius-0 and radius-rounded are always fixed (never affected by multiplier).
+ * radius-1 through radius-4 = base * step * multiplier.
+ *
+ * When omitted, themes use the hardcoded defaults (base=4, multiplier=1).
+ * Explicit `tokens` overrides take precedence over radiusScale-generated values.
+ *
+ * @example
+ * ```tsx
+ * radiusScale: { base: 4, multiplier: 1 }
+ *
+ * // Sharp/brutalist — all radii become 0
+ * radiusScale: { base: 4, multiplier: 0 }
+ * ```
+ */
+ radiusScale?: XDSRadiusScaleConfig;
/** Token overrides — flat map of CSS custom property names to values.
* Values can be a string or [light, dark] tuple.
* Only include tokens you want to override; defaults fill the rest. */
@@ -270,7 +293,15 @@ export function defineTheme(input: XDSDefineThemeInput): XDSDefinedTheme {
}
}
- // 2. Apply explicit token overrides (highest precedence — overwrites typeScale)
+ // 1b. Apply radiusScale-generated tokens (lowest precedence for radius)
+ if (input.radiusScale) {
+ const radiusTokens = expandRadiusScale(input.radiusScale);
+ for (const [key, value] of Object.entries(radiusTokens)) {
+ tokens[key] = value;
+ }
+ }
+
+ // 2. Apply explicit token overrides (highest precedence — overwrites typeScale/radiusScale)
if (input.tokens) {
for (const [key, value] of Object.entries(input.tokens)) {
if (value !== undefined) {
@@ -328,9 +359,7 @@ function toKebabCase(str: string): string {
* When false (default), prose rules use var() references to token custom properties
* (for the runtime path where tokens are set on :scope).
*/
-export function generateThemeRules(
- theme: XDSDefinedTheme,
-): string[] {
+export function generateThemeRules(theme: XDSDefinedTheme): string[] {
const parts: string[] = [];
const tokens = theme.tokens;
@@ -350,7 +379,9 @@ export function generateThemeRules(
// 2. Component overrides (.xds-* class rules)
if (theme.components) {
for (const [component, rules] of Object.entries(theme.components)) {
- for (const [key, styles] of Object.entries(rules as Record<string, Record<string, string>>)) {
+ for (const [key, styles] of Object.entries(
+ rules as Record<string, Record<string, string>>,
+ )) {
const entries = Object.entries(styles);
if (entries.length > 0) {
const suffix = parseStyleKey(key);
diff --git a/packages/core/src/theme/expandRadiusScale.test.ts b/packages/core/src/theme/expandRadiusScale.test.ts
new file mode 100644
index 0000000000..a0a2049602
--- /dev/null
+++ b/packages/core/src/theme/expandRadiusScale.test.ts
@@ -0,0 +1,54 @@
+import {describe, it, expect} from 'vitest';
+import {expandRadiusScale} from './expandRadiusScale';
+
+describe('expandRadiusScale', () => {
+ it('generates default scale', () => {
+ const tokens = expandRadiusScale({base: 4, multiplier: 1});
+ expect(tokens['--radius-0']).toBe('0px');
+ expect(tokens['--radius-1']).toBe('4px');
+ expect(tokens['--radius-2']).toBe('8px');
+ expect(tokens['--radius-3']).toBe('12px');
+ expect(tokens['--radius-4']).toBe('16px');
+ expect(tokens['--radius-rounded']).toBe('9999px');
+ });
+
+ it('applies multiplier', () => {
+ const tokens = expandRadiusScale({base: 4, multiplier: 1.5});
+ expect(tokens['--radius-1']).toBe('6px');
+ expect(tokens['--radius-2']).toBe('12px');
+ expect(tokens['--radius-3']).toBe('18px');
+ expect(tokens['--radius-4']).toBe('24px');
+ });
+
+ it('multiplier 0 produces all zeros', () => {
+ const tokens = expandRadiusScale({base: 4, multiplier: 0});
+ expect(tokens['--radius-0']).toBe('0px');
+ expect(tokens['--radius-1']).toBe('0px');
+ expect(tokens['--radius-2']).toBe('0px');
+ expect(tokens['--radius-3']).toBe('0px');
+ expect(tokens['--radius-4']).toBe('0px');
+ expect(tokens['--radius-rounded']).toBe('9999px');
+ });
+
+ it('fixed tokens are unaffected by multiplier', () => {
+ const tokens = expandRadiusScale({base: 4, multiplier: 2});
+ expect(tokens['--radius-0']).toBe('0px');
+ expect(tokens['--radius-rounded']).toBe('9999px');
+ });
+
+ it('rounds fractional results to nearest integer', () => {
+ const tokens = expandRadiusScale({base: 3, multiplier: 1.3});
+ // 3 * 1 * 1.3 = 3.9 → 4px
+ expect(tokens['--radius-1']).toBe('4px');
+ // 3 * 2 * 1.3 = 7.8 → 8px
+ expect(tokens['--radius-2']).toBe('8px');
+ });
+
+ it('works with non-standard base', () => {
+ const tokens = expandRadiusScale({base: 6, multiplier: 1});
+ expect(tokens['--radius-1']).toBe('6px');
+ expect(tokens['--radius-2']).toBe('12px');
+ expect(tokens['--radius-3']).toBe('18px');
+ expect(tokens['--radius-4']).toBe('24px');
+ });
+});
diff --git a/packages/core/src/theme/expandRadiusScale.ts b/packages/core/src/theme/expandRadiusScale.ts
new file mode 100644
index 0000000000..dcec2a7fac
--- /dev/null
+++ b/packages/core/src/theme/expandRadiusScale.ts
@@ -0,0 +1,81 @@
+/**
+ * @file expandRadiusScale.ts
+ * @input Radius scale configuration { base, multiplier }
+ * @output Token overrides for radius tokens
+ * @position Theme utility; consumed by defineTheme.ts
+ *
+ * Computes border-radius values from a base unit and multiplier.
+ * radius-0 and radius-rounded are always fixed (never affected by multiplier).
+ * radius-1 through radius-4 = base * step * multiplier.
+ *
+ * SYNC: When modified, update:
+ * - /packages/core/src/theme/expandRadiusScale.test.ts
+ * - /packages/core/src/theme/defineTheme.ts
+ */
+
+// =============================================================================
+// Types
+// =============================================================================
+
+/**
+ * Radius scale configuration.
+ *
+ * @example
+ * ```
+ * // Default XDS radius scale
+ * { base: 4, multiplier: 1 }
+ *
+ * // Sharp/brutalist — all radii become 0
+ * { base: 4, multiplier: 0 }
+ *
+ * // Extra rounded
+ * { base: 4, multiplier: 1.5 }
+ * ```
+ */
+export interface XDSRadiusScaleConfig {
+ /** Base radius unit in px. Default: 4 */
+ base: number;
+ /** Multiplier applied to all scalable tokens. Default: 1. Range: 0-2 */
+ multiplier: number;
+}
+
+/**
+ * Generated radius token overrides.
+ * Keys are CSS custom property names, values are CSS strings.
+ */
+export type RadiusScaleTokens = Record<string, string>;
+
+// =============================================================================
+// Computation
+// =============================================================================
+
+/**
+ * Expand a radius scale config into token overrides.
+ *
+ * radius-0 and radius-rounded are always fixed (never affected by multiplier).
+ * radius-1 through radius-4 = base * step * multiplier
+ *
+ * @example
+ * ```
+ * const tokens = expandRadiusScale({ base: 4, multiplier: 1 });
+ * // tokens['--radius-0'] === '0px'
+ * // tokens['--radius-1'] === '4px'
+ * // tokens['--radius-2'] === '8px'
+ * // tokens['--radius-3'] === '12px'
+ * // tokens['--radius-4'] === '16px'
+ * // tokens['--radius-rounded'] === '9999px'
+ * ```
+ */
+export function expandRadiusScale(
+ config: XDSRadiusScaleConfig,
+): RadiusScaleTokens {
+ const {base, multiplier} = config;
+ return {
+ '--radius-0': '0px',
+ '--radius-1': `${Math.round(base * 1 * multiplier)}px`,
+ '--radius-2': `${Math.round(base * 2 * multiplier)}px`,
+ '--radius-3': `${Math.round(base * 3 * multiplier)}px`,
+ '--radius-4': `${Math.round(base * 4 * multiplier)}px`,
+ '--radius-rounded': '9999px',
+ };
+}
diff --git a/packages/core/src/theme/index.ts b/packages/core/src/theme/index.ts
index 47fe255a20..fb5d025fb9 100644
--- a/packages/core/src/theme/index.ts
+++ b/packages/core/src/theme/index.ts
@@ -31,6 +31,12 @@ export type {
export {expandTypeScale, generateTypeScaleComponents} from './expandTypeScale';
export type {XDSTypeScaleConfig, TypeScaleTokens} from './expandTypeScale';
+export {expandRadiusScale} from './expandRadiusScale';
+export type {
+ XDSRadiusScaleConfig,
+ RadiusScaleTokens,
+} from './expandRadiusScale';
+
// Export token defaults and vars for use in custom components and themes
export {
colorDefaults,
diff --git a/packages/core/src/theme/tokens.stylex.ts b/packages/core/src/theme/tokens.stylex.ts
index 1d8fdf3f08..5f71f03e61 100644
--- a/packages/core/src/theme/tokens.stylex.ts
+++ b/packages/core/src/theme/tokens.stylex.ts
@@ -185,12 +185,12 @@ export const sizeVars = stylex.defineVars(sizeDefaults);
// =============================================================================
export const radiusDefaults = {
+ '--radius-0': '0px',
+ '--radius-1': '4px',
+ '--radius-2': '8px',
+ '--radius-3': '12px',
+ '--radius-4': '16px',
'--radius-rounded': '9999px',
- '--radius-container': '12px',
- '--radius-element': '8px',
- '--radius-content': '4px',
- '--radius-inner': '0px',
- '--radius-page': '20px',
} as const;
/** @deprecated Use radiusDefaults */
diff --git a/packages/lab/src/CommandPalette/XDSCommandPaletteItem.tsx b/packages/lab/src/CommandPalette/XDSCommandPaletteItem.tsx
index 51899c35ac..28229da3b5 100644
--- a/packages/lab/src/CommandPalette/XDSCommandPaletteItem.tsx
+++ b/packages/lab/src/CommandPalette/XDSCommandPaletteItem.tsx
@@ -39,7 +39,7 @@ const styles = stylex.create({
width: '100%',
paddingInline: spacingVars['--spacing-3'],
paddingBlock: spacingVars['--spacing-2'],
- borderRadius: radiusVars['--radius-content'],
+ borderRadius: radiusVars['--radius-1'],
fontFamily: typographyVars['--font-body'],
fontSize: textSizeVars['--text-base'],
color: colorVars['--color-text-primary'],
diff --git a/packages/themes/brutalist/src/index.ts b/packages/themes/brutalist/src/index.ts
index 899ef3ac27..09e02752a7 100644
--- a/packages/themes/brutalist/src/index.ts
+++ b/packages/themes/brutalist/src/index.ts
@@ -10,6 +10,10 @@ import {defineTheme} from '@xds/core/theme';
export const brutalistTheme = defineTheme({
name: 'brutalist',
+
+ // Zero radius everywhere — multiplier 0 makes all scalable radii 0px
+ radiusScale: {base: 4, multiplier: 0},
+
tokens: {
// Colors — high contrast, no subtlety
'--color-accent': ['#FF1493', '#FF69B4'],
@@ -18,11 +22,7 @@ export const brutalistTheme = defineTheme({
'--color-wash': ['#F5F5F5', '#111111'],
'--color-card': ['#FFFFFF', '#000000'],
- // Zero radius everywhere
- '--radius-container': '0px',
- '--radius-element': '0px',
- '--radius-content': '0px',
- '--radius-inner': '0px',
+ // Even pills are sharp in brutalist
'--radius-rounded': '0px',
// Monospace headings
diff --git a/packages/themes/neutral/src/neutralTheme.ts b/packages/themes/neutral/src/neutralTheme.ts
index 81786a2d68..b710750e3a 100644
--- a/packages/themes/neutral/src/neutralTheme.ts
+++ b/packages/themes/neutral/src/neutralTheme.ts
@@ -257,11 +257,11 @@ export const neutralTheme = defineTheme({
// =========================================================================
// Radius — slightly larger than default
// =========================================================================
+ '--radius-0': '0.25rem',
+ '--radius-1': '0.375rem',
+ '--radius-2': '0.625rem',
+ '--radius-3': '0.75rem',
'--radius-rounded': '9999px',
- '--radius-container': '0.75rem',
- '--radius-element': '0.625rem',
- '--radius-content': '0.375rem',
- '--radius-inner': '0.25rem',
// =========================================================================
// Elevation — oklch-based shadows