Skip to content

feat: Add icon support to Badge - #4973

Draft
jperals wants to merge 1 commit into
mainfrom
dev-v3-jotresse-badge-icon
Draft

feat: Add icon support to Badge#4973
jperals wants to merge 1 commit into
mainfrom
dev-v3-jotresse-badge-icon

Conversation

@jperals

@jperals jperals commented Sep 4, 2026

Copy link
Copy Markdown
Member

Add the ability to render an icon inside a Badge, modeled on the Button component's icon feature.

  • Add iconName, iconUrl, iconSvg, iconAlt, and iconAlign props to BadgeProps. The icon uses size="inherit" and a flex container so it stays vertically centered with the label text.
  • Extract shared iconName/iconUrl/iconAlt props into a new BaseIconProps interface consumed by both Badge and Button. iconSvg is intentionally left out, since its documentation is component-specific.
  • Add stable .content and .icon test-util selectors in a dedicated badge/test-classes/styles.scss, decoupled from structural styles.
  • Add findIcon and findContent methods to the Badge test-utils wrapper, using findContent to match the library-wide convention.
  • Add a badge icon permutations dev page.
  • Update documenter and test-utils selectors snapshots.

Description

Related links, issue #, if available: n/a

How has this been tested?

Visual regression tests will be added in follow-up PR.

Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Add the ability to render an icon inside a Badge, modeled on the
Button component's icon feature.

- Add iconName, iconUrl, iconSvg, iconAlt, and iconAlign props to
  BadgeProps. The icon uses size="inherit" and a flex container so it
  stays vertically centered with the label text.
- Extract shared iconName/iconUrl/iconAlt props into a new
  BaseIconProps interface consumed by both Badge and Button. iconSvg is
  intentionally left out, since its documentation is component-specific.
- Add stable .content and .icon test-util selectors in a dedicated
  badge/test-classes/styles.scss, decoupled from structural styles.
- Add findIcon and findContent methods to the Badge test-utils wrapper,
  using findContent to match the library-wide convention.
- Add a badge icon permutations dev page.
- Update documenter and test-utils selectors snapshots.
@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.66%. Comparing base (0c1c9fd) to head (5b35931).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4973   +/-   ##
=======================================
  Coverage   97.66%   97.66%           
=======================================
  Files         959      959           
  Lines       31345    31362   +17     
  Branches    11579    11589   +10     
=======================================
+ Hits        30614    30631   +17     
  Misses        724      724           
  Partials        7        7           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant