Skip to content

[EuiFormControlButton] Fix alignment for icons when no label is passed#9588

Merged
mgadewoll merged 6 commits intoelastic:mainfrom
mgadewoll:formcontrolbutton/fix-alignment
Apr 13, 2026
Merged

[EuiFormControlButton] Fix alignment for icons when no label is passed#9588
mgadewoll merged 6 commits intoelastic:mainfrom
mgadewoll:formcontrolbutton/fix-alignment

Conversation

@mgadewoll
Copy link
Copy Markdown
Contributor

@mgadewoll mgadewoll commented Apr 10, 2026

Summary

This PR fixes a visual issue in EuiFormControlButton where a right aligned icon would not be placed on the right side if no button label is passed via value.

To track regression, this PR adds more technically possible usages to the Kitchensink story.

API Changes

🟢 No API changes.

Screenshots

Before After
Screenshot 2026-04-10 at 13 17 33 Screenshot 2026-04-10 at 13 18 23
Screenshot 2026-04-10 at 13 17 38 Screenshot 2026-04-10 at 13 18 28

Impact Assessment

Note: Most PRs should be tested in Kibana to help gauge their Impact before merging.

  • 🔴 Breaking changes — What will break? How many usages in Kibana/Cloud UI are impacted?
  • 💅 Visual changes — May impact style overrides; could require visual testing. Explain and estimate impact.
  • 🧪 Test impact — May break functional or snapshot tests (e.g., HTML structure, class names, default values).
  • 🔧 Hard to integrate — If changes require substantial updates to Kibana, please stage the changes and link them here.

Impact level: 🟢 None - 🟢 Low

Due to an added Emotion class, there could be snapshots that need updating.

Release Readiness

  • Documentation: {link to docs page(s)}
  • Figma: {link to Figma or issue}
  • Migration guide: {steps or link, for breaking/visual changes or deprecations}
  • Adoption plan (new features): {link to issue/doc or outline who will integrate this and where}

QA instructions for reviewer

💻 EuiFormControlButton storybook

  • verify that the usage of only iconType and iconSide without value align as expected (iconSide="right" -> right aligned, iconSide="left" -> left aligned)
  • verify there is no other unexpected regression with production

Checklist before marking Ready for Review

Reviewer checklist

  • Approved Impact Assessment — Acceptable to merge given the consumer impact.
  • Approved Release Readiness — Docs, Figma, and migration info are sufficient to ship.

@mgadewoll mgadewoll self-assigned this Apr 10, 2026
@mgadewoll mgadewoll marked this pull request as ready for review April 10, 2026 12:17
@mgadewoll mgadewoll requested a review from a team as a code owner April 10, 2026 12:17
Copilot AI review requested due to automatic review settings April 10, 2026 12:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a visual regression in EuiFormControlButton where icon-only buttons with iconSide="right" were not aligning the icon to the right when no label text (value/placeholder) is present, and expands the Storybook kitchensink cases + VRT references to prevent regressions.

Changes:

  • Adds a hasText/iconSide-based conditional style to right-align icon-only content.
  • Introduces a new Emotion style (alignEnd) for content alignment.
  • Refactors/expands the kitchensink story and updates Loki reference screenshots; adds an upcoming changelog entry.

Reviewed changes

Copilot reviewed 4 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/eui/src/components/form/form_control_button/form_control_button.tsx Adds conditional content alignment when there is no text and the icon is on the right.
packages/eui/src/components/form/form_control_button/form_control_button.styles.ts Adds alignEnd style (justify-content: flex-end).
packages/eui/src/components/form/form_control_button/form_control_button.stories.tsx Refactors kitchensink rendering and adds icon-only scenarios for VRT coverage.
packages/eui/changelogs/upcoming/9588.md Documents the bug fix in upcoming changelog.
packages/eui/.loki/reference/*.png Updates VRT reference images for the expanded kitchensink cases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/eui/src/components/form/form_control_button/form_control_button.tsx Outdated
@elasticmachine
Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

cc @mgadewoll

@elasticmachine
Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

cc @mgadewoll

Copy link
Copy Markdown
Contributor

@weronikaolejniczak weronikaolejniczak left a comment

Choose a reason for hiding this comment

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

LGTM 🟢 Thanks for fixing it, Lene!

@mgadewoll mgadewoll merged commit 877de18 into elastic:main Apr 13, 2026
5 checks passed
@mgadewoll mgadewoll deleted the formcontrolbutton/fix-alignment branch April 13, 2026 09:52
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.

4 participants