Skip to content

feat(Badge): add non-semantic color variants - #1109

Merged
cixzhang merged 2 commits into
mainfrom
navi/feat/badge-nonsemantic-colors
Apr 4, 2026
Merged

cixzhang merged 2 commits into
mainfrom
navi/feat/badge-nonsemantic-colors

Conversation

@cixzhang

@cixzhang cixzhang commented Apr 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add 9 non-semantic color variants to XDSBadge for categorization and tagging use cases where color doesn't carry semantic meaning.

New variants

blue · cyan · green · orange · pink · purple · red · teal · yellow

Design

  • Semantic variants (neutral, info, success, warning, error) → solid backgrounds, on-media text
  • Non-semantic variants → tinted backgrounds (--color-{color}-background) with colored text (--color-{color}-text)

All colors map to existing theme tokens — no new tokens needed.

Changes

  • XDSBadge.tsx — 9 new variant styles
  • XDSBadge.test.tsx — tests for all non-semantic variants + xds class name
  • Badge.stories.tsx — new NonSemanticColors story
  • Badge.doc.mjs — updated variant type and examples

Closes #244
Ref #719


@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Apr 4, 2026
@cixzhang
cixzhang force-pushed the navi/feat/badge-nonsemantic-colors branch 2 times, most recently from f4e86d1 to 0cd43df Compare April 4, 2026 03:49
@github-actions

github-actions Bot commented Apr 4, 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

Badge · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 264B N/A
Lines of Code N/A 179 -
Complexity N/A Low (1) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@xds/core 12.3KB 19.4KB 3.0KB

Accessibility Audit

Status: No accessibility violations detected.


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

cixzhang and others added 2 commits April 4, 2026 14:49
Add 9 non-semantic color variants (blue, cyan, green, orange, pink,
purple, red, teal, yellow) for categorization and tagging use cases
where color doesn't carry semantic meaning.

Non-semantic variants use tinted backgrounds with colored text,
while semantic variants keep their solid backgrounds.

All colors map to existing theme tokens (--color-{color}-background
and --color-{color}-text) — no new tokens needed.

Closes #244

Co-authored-by: Navi <[email protected]>
- Fix token names: --color-background-{color} / --color-text-{color}
- Remove shape prop and dot mode (codemod shipped in #949)
- Add non-semantic colors to XDSBadgeVariantMap
- Remove dot references from docs, tests, and stories

Co-authored-by: Navi <[email protected]>
@cixzhang
cixzhang force-pushed the navi/feat/badge-nonsemantic-colors branch from ee7386a to ad1ab86 Compare April 4, 2026 14:49
@cixzhang
cixzhang merged commit 5b0aed5 into main Apr 4, 2026
16 checks passed
@cixzhang
cixzhang deleted the navi/feat/badge-nonsemantic-colors branch April 9, 2026 14:30
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.

XDSBadge: Add non-semantic color variants and darken neutral grey

1 participant