feat(eui): make EuiFormControlLayoutIcons top-aligned#8590
Closed
weronikaolejniczak wants to merge 7 commits intoelastic:mainfrom
Closed
feat(eui): make EuiFormControlLayoutIcons top-aligned#8590weronikaolejniczak wants to merge 7 commits intoelastic:mainfrom
weronikaolejniczak wants to merge 7 commits intoelastic:mainfrom
Conversation
7acecae to
cf2d048
Compare
19c2546 to
eea6cd3
Compare
acstll
reviewed
Apr 15, 2025
packages/eui/src/components/form/form_control_layout/form_control_layout_icons.styles.ts
Show resolved
Hide resolved
mgadewoll
reviewed
Apr 17, 2025
f7a3e8c to
f600952
Compare
|
Preview staging links for this PR:
|
f600952 to
8d258b3
Compare
Collaborator
28 tasks
Collaborator
💔 Build Failed
Failed CI StepsHistory
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Relates to #8553
This PR updates the
EuiFormControlLayoutIconscomponent to align icons to the top instead of the center. To do this, I apply a calculatedpadding-topusing the formula:(control height - icon size) / 2. This value is not directly tied tocontrolPaddingorcontrolCompressedPadding.For the uncompressed variant, the calculated value happens to match
controlPadding((40px - 16px) / 2 = 12px), so there's no visual difference. However, for the compressed variant, the correct top padding should be10px((32px - 12px) / 2 = 10px) which doesn’t align with the standard 4-based modular scale (where the nearest value would be8px, the value ofcontrolCompressedPadding). We want to make it work across themes and theme overrides, so we have to avoid hard-coding values.We have to account for cases where the border is applied to the layout group and the actual control is
x - 2px. This includes icon position static, append / prepend andEuiFormControlLayoutDelimited.Instead of fixing this only for
EuiComboBox, I’ve applied the change globally to all form controls, as suggested in the original issue. See the impact details below.Note
This update should allow us to remove the local style override introduced in Kibana PR #217132.
Additional information
Component overrides
Targeting
.euiFormControlLayoutIconsclass:packages/eui/src/components/date_picker/date_picker_range.styles.ts:79packages/eui/src/components/date_picker/date_picker.styles.ts:42packages/eui/src/components/form/text_area/text_area.styles.ts:88packages/eui-theme-common/src/global_styling/mixins/_form.scss:211Component impact
eui/packages/eui/src/components/color_picker/color_picker.tsxeui/packages/eui/src/components/combo_box/combo_box_input/combo_box_input.tsxeui/packages/eui/src/components/date_picker/date_picker.tsxeui/packages/eui/src/components/date_picker/date_picker_range.styles.tseui/packages/eui/src/components/date_picker/super_date_picker/super_date_picker.tsxeui/packages/eui/src/components/form/field_number/field_number.tsxeui/packages/eui/src/components/form/field_password/field_password.tsxeui/packages/eui/src/components/form/field_search/field_search.tsxeui/packages/eui/src/components/form/field_text/field_text.tsxeui/packages/eui/src/components/form/form_control_layout/form_control_layout_delimited.tsxeui/packages/eui/src/components/form/select/select.tsxeui/packages/eui/src/components/form/super_select/super_select_control.tsxeui/packages/eui/src/components/form/text_area/text_area.tsxQA
General checklist
Checked in both light and dark modesChecked in both MacOS and Windows high contrast modesEdge, and FirefoxChecked for accessibility including keyboard-only and screenreader modesAdded documentationProps have proper autodocs (using@defaultif default values are missing) and playground togglesChecked Code Sandbox works for any docs examplesIf applicable, added the breaking change issue label (and filled out the breaking change 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)Specific checklist
EuiComboBoxwith a lot of selected optionscompressedanduncompressedvariants, bothstaticandabsoluteicon positions