Skip to content

Conversation

mgadewoll
Copy link
Contributor

@mgadewoll mgadewoll commented Sep 11, 2025

Summary

closes https://github.com/elastic/eui-private/issues/270

This PR adds a new EUI component: EuiFormControlButton.
This component is meant to be used in form layouts (within EuiFormControlLayout) when a button element is needed that maintains the visual relation to form elements.

EuiFormControlButton combines a base set of props from EuiButtonEmpty with form related props to ensure it behaves like an input element within EuiFormControlLayout.

Changes

  • Adds EuiFormControlButton (component, tests, stories and documentation)
  • Updates EuiSuperDatePicker to use EuiFormControlButton when showPrettyDuration

Ideation

Initially, the idea was to provide EuiFormControlButton and a specific EuiFormFilterButton component which would have inherited functionality from EuiFilterButton and styling from EuiFormControlButton. EuiFormFilterButton would have been a direct replacement for the existing usage of EuiFilterButton inside EuiFormControlLayout but creating a component for a single use case seemed excessive.

Instead, the expected usage now is to use the more generic EuiFormControlButton and handle the filter badge output manually by passing the EuiBadgeNotification as content (usage, example). It's slightly less convenient but seems more reasonable for the time being. If more use cases may appear, we could reconsider adding a dedicated component.

Screenshot 2025-09-11 at 12 09 13

Why are we making this change?

💅 UI consistency: Adding this component solves a design and usage requirement on consumer side. Currently consumers are using regular buttons inside form layouts which results in unwanted visual output.

Screenshots #

EuiFormControlButton

LIGHT DARK
Screenshot 2025-09-11 at 12 11 55 Screenshot 2025-09-11 at 12 12 01

EuiFormControlButton within EuiFormControlLayout

LIGHT DARK
Screenshot 2025-09-11 at 12 12 15 Screenshot 2025-09-11 at 12 12 20
Screenshot 2025-09-11 at 12 15 17 Screenshot 2025-09-11 at 12 15 12

Kibana Dashboard control

before after
Screenshot 2025-09-11 at 12 24 05 Screenshot 2025-09-11 at 16 46 58

EuiSuperDatePicker

before after
Screenshot 2025-09-11 at 12 40 36 Screenshot 2025-09-11 at 12 40 45
Screenshot 2025-09-11 at 12 44 34 Screenshot 2025-09-11 at 12 44 31

Impact to users

🟢 There are no updates required by consumers.

ℹ️ ⚠️ We want to update the existing use case on Kibana. The update was prepared here

QA

💻 The changes have additionally been added and deployed in Kibana (instance, credentials)

  • compare EuiFormControlButton (Storybook) and e.g. EuiFieldText (Storybook) and verify that they look alike (in terms of colors, text, border, states etc)
  • verify that the usage of EuiFormControlButton inside EuiFormControlLayout (Storybook) works as expected (form layout props render correctly)
  • review the added documentation and verify it's complete and comprehensible

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)
  • 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 Sep 11, 2025
@mgadewoll mgadewoll requested a review from ek-so September 11, 2025 10:51
@mgadewoll mgadewoll force-pushed the forms/270-input-buttons branch from 703f629 to 45c37cd Compare September 11, 2025 13:09
@mgadewoll mgadewoll marked this pull request as ready for review September 11, 2025 17:43
@mgadewoll mgadewoll requested a review from a team as a code owner September 11, 2025 17:43
@mgadewoll mgadewoll requested review from JoseLuisGJ and removed request for ek-so September 12, 2025 08:12
@JoseLuisGJ
Copy link
Contributor

LGTM 🚀

@acstll acstll self-requested a review September 15, 2025 10:48
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.

A few minor things (mostly questions) — personally knowing the issue, I think the solution/execution are spot on ✨

<EuiFormControlLayout {...args} clear={{ onClick: handleOnClear }}>
<EuiInputPopover
ownFocus
input={formControlButton}
Copy link
Contributor

@acstll acstll Sep 15, 2025

Choose a reason for hiding this comment

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

[question] 💭 this input={...Button} felt weird at first sight, but I guess it represents the whole point of this new component — still I was wondering: is there anything we could/should do to ensure this new button works as well with regular EuiPopover.button?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is there anything we could/should do to ensure this new button works as well with regular EuiPopover.button?

@acstll It already works as expected also with EuiPopover 🙂

The screen recoding shows the following:

  • EuiFormControlButton with EuiPopover within EuiFormControlLayout (requires EuiPopover to have display: 'block')
  • EuiFormControlButton with EuiPopover
<EuiFormControlLayout {...args} clear={{ onClick: handleOnClear }}>
  <EuiPopover
    button={formControlButton}
    isOpen={isPopoverOpen}
    closePopover={() => {}}
    display="block"
  >
    content
  </EuiPopover>
</EuiFormControlLayout>

<EuiPopover
  isOpen={isPopoverOpen}
  button={formControlButton}
  closePopover={() => {}}
>
  content
</EuiPopover>
Screen.Recording.2025-09-30.at.12.05.21.mov

Comment on lines +198 to +200
<EuiInputPopover
ownFocus
input={(
Copy link
Contributor

Choose a reason for hiding this comment

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

following up on the previous comment, would it make sense to add a sentence (admonition?) suggesting the usage of EuiInputPopover over EuiPopover?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure that we need to be that specific. In theory EuiFormControlButton could be used as any kind of trigger, also for EuiPopover.

Comment on lines +81 to +89
it('is rendered', () => {
const { getByTestSubject } = render(
<EuiFormControlButton {...defaultProps} />
);

expect(
getByTestSubject(defaultProps['data-test-subj'])
).toHaveTextContent(defaultProps.value);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

[question] did you think about the <button>'s value attribute? would it make sense to also render value as value={value} in the button itself? I really don't think it will ever be needed (thinking about Kibana), but I didn't want to not (at least) bring it up 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good suggestion. Since it's a native attribute, we should pass it along even if it's most likely not gonna be used. 👍
Updated in ba522fc

@mgadewoll mgadewoll marked this pull request as draft September 17, 2025 08:23
@mgadewoll
Copy link
Contributor Author

mgadewoll commented Sep 17, 2025

ℹ️ Moving this PR back to draft for now, as there have been some discussions around ongoing updates in Kibana Dashboards that might have an effect on the need/requirement. Once we know more, we can update/proceed.

@mgadewoll
Copy link
Contributor Author

ℹ️ Moving this PR back to draft for now, as there have been some discussions around ongoing updates in Kibana Dashboards that might have an effect on the need/requirement. Once we know more, we can update/proceed.

ℹ️ Dashboards confirmed that our update can proceed and the adjustments needed for the new project would be done on Kibana side.

@mgadewoll mgadewoll force-pushed the forms/270-input-buttons branch from 45c37cd to ba522fc Compare September 30, 2025 11:34
@mgadewoll mgadewoll requested a review from acstll September 30, 2025 11:35
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @mgadewoll

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @mgadewoll

@mgadewoll mgadewoll marked this pull request as ready for review September 30, 2025 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants