Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[EuiBadge] Add hover styles#9418

Merged
mgadewoll merged 8 commits intoelastic:mainfrom
mgadewoll:badge/9407-hover-styles
Mar 3, 2026
Merged

[EuiBadge] Add hover styles#9418
mgadewoll merged 8 commits intoelastic:mainfrom
mgadewoll:badge/9407-hover-styles

Conversation

@mgadewoll
Copy link
Contributor

@mgadewoll mgadewoll commented Mar 2, 2026

Summary

closes #9407

This PR updates EuiBadge by updating/adding hover styles.

Changes

  • Exports button interaction styles as euiButtonInteractionStyles
  • Added background color change for :hover and :active states (uses euiButtonInteractionStyles)
    • Added background color change for custom badge colors as well, using "guesstimated" color calculations
  • Removed text-decoration: underline style on hover by default, leaving it only for high contrast mode (HCM) styles

Why are we making this change?

πŸ’… UI redesign: This update is part of the overall redesign of badges as well as selectable items (https://github.com/elastic/platform-ux-team/issues/1050)

Screenshots #

before after
Screen.Recording.2026-03-02.at.09.10.55.mov
Screen.Recording.2026-03-02.at.09.11.30.mov
Screen.Recording.2026-03-02.at.09.11.13.mov
Screen.Recording.2026-03-02.at.09.11.54.mov
  • Example custom colors
Screen.Recording.2026-03-02.at.09.12.30.mov
  • High contrast mode
fill base custom
Screen.Recording.2026-03-02.at.09.20.09.mov
Screen.Recording.2026-03-02.at.09.20.23.mov
Screen.Recording.2026-03-02.at.09.20.35.mov

Impact to users

🟒 No updates required on consumer side.

ℹ️ Due to the style changes, DOM snapshots might require updates due to changed Emotion class names.

QA

Design specs: https://www.figma.com/design/FHys7gLzyvD1gc9DrJM6D8/Elastic-UI--Borealis-?node-id=7272-30925&p=f&t=liHyqo3oLOHvDB4J-0

  • verify that EuiBadge with onClick has hover and active styles that match button styles
  • verify that EuiBadge with iconOnClick has hover and active styles that match button styles
  • verify that EuiBadge in HCM has text-decoration: underline styles for hover, active and focus states

General checklist

  • Browser QA
    • Checked in both light and dark modes
    • Checked in both MacOS and Windows high contrast modes
    • Checked in mobile
    • Checked in Chrome, Safari, Edge, and Firefox
    • Checked for accessibility including keyboard-only and screenreader modes
  • Docs site QA
  • Code quality checklist
  • Release checklist
    • A changelog entry exists and is marked appropriately
    • If applicable, added the breaking change issue label (and filled out the breaking change checklist)
    • If the changes unblock an issue in a different repo, smoke tested carefully (see Testing EUI features in Kibana ahead of time)
  • Designer checklist
    • If applicable, file an issue to update EUI's Figma library with any corresponding UI changes. (This is an internal repo, if you are external to Elastic, ask a maintainer to submit this request)

@mgadewoll mgadewoll self-assigned this Mar 2, 2026
@mgadewoll mgadewoll requested a review from ek-so March 2, 2026 08:32
Copy link
Contributor

@ek-so ek-so left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mgadewoll thank you, lgtm!
One small nit/question: do you think it makes sense to set the focus ring to be a bit larger (outside) of the badge, given its small size? πŸ€”

@mgadewoll mgadewoll marked this pull request as ready for review March 2, 2026 09:40
@mgadewoll mgadewoll requested a review from a team as a code owner March 2, 2026 09:40
@acstll acstll self-requested a review March 2, 2026 11:03
@mgadewoll mgadewoll force-pushed the badge/9407-hover-styles branch from 54ae30d to 30b8b7c Compare March 2, 2026 15:53
Copy link
Contributor

@acstll acstll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟒 Working as expected (thanks for providing QA guidance). A typo, and a question only in case you think it's worth looking into it.

@mgadewoll
Copy link
Contributor Author

@mgadewoll thank you, lgtm! One small nit/question: do you think it makes sense to set the focus ring to be a bit larger (outside) of the badge, given its small size? πŸ€”

@ek-so Yes definitely πŸ‘
Updated in 30b8b7c.

ℹ️ Using the regular 2px outline offset would mean we have the blue outline directly on the badge which would be hard to see for blue badges. I increased the offset to 3px. We might need to see if that creates issues somewhere as the focus outline could be cut of by parent wrappers.

Once we update the global focus and maybe make it more smart (could we somehow support flipping inside and outside focus color?) we could likely reduce this.

@elasticmachine
Copy link
Collaborator

πŸ’š Build Succeeded

History

cc @mgadewoll

@elasticmachine
Copy link
Collaborator

πŸ’” Build Failed

Failed CI Steps

History

cc @mgadewoll

@mgadewoll mgadewoll merged commit b2f01b4 into elastic:main Mar 3, 2026
5 checks passed
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.

[EuiBadge] Add hover styles

4 participants