Skip to content

feat: Customise tooltip offset optional prop - #8988

Merged
paulinashakirova merged 6 commits into
elastic:mainfrom
paulinashakirova:customise-tooltip-offset-optional-prop
Sep 5, 2025
Merged

paulinashakirova merged 6 commits into
elastic:mainfrom
paulinashakirova:customise-tooltip-offset-optional-prop

Conversation

@paulinashakirova

@paulinashakirova paulinashakirova commented Sep 2, 2025 •

Copy link
Copy Markdown

Summary

This pull request adds support for customizing the offset of the tooltip in the EuiToolTip component, allowing developers to specify how far the tooltip should appear from its anchor element. The default offset remains 16 pixels, but this can now be overridden via a new prop. The changes also include updates to tests and documentation to cover this new feature.

Feature enhancement: Tooltip offset customization

  • Added an offset prop to the EuiToolTipProps interface, allowing consumers to specify the tooltip's offset in pixels from the anchor. The default value is 16.
  • Updated the tooltip positioning logic in EuiToolTip to use the provided offset prop value, falling back to 16 if not specified. [1] [2]

Documentation and testing

  • Added a new test to verify that the tooltip uses a custom offset value when the prop is set.
  • Updated the component story default args to include the new offset prop.
  • Added a snapshot for the tooltip with a custom offset to ensure visual correctness.

Why are we making this change?

While the default offset of 16px works well for most use cases, we’ve encountered scenarios—especially when reworking navigation in Kibana—where a custom offset is needed. The side navigation is unique in that we want tooltips to be positioned more closely to their triggers, and the triggers themselves must be 100% width for consistent popover/tooltip positioning.

Screenshots

Screen.Recording.2025-09-02.at.12.51.44.mov

Kapture 2025-08-06 at 16 44 33

Screenshot 2025-09-02 at 10 34 39

Impact to users

This is not a breaking change, it is on opt-in basis.

QA

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)

@paulinashakirova paulinashakirova self-assigned this Sep 2, 2025
@paulinashakirova
paulinashakirova marked this pull request as ready for review September 2, 2025 11:33
@paulinashakirova
paulinashakirova requested a review from a team as a code owner September 2, 2025 11:34
@mgadewoll
mgadewoll self-requested a review September 3, 2025 07:45
@elasticmachine

Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

cc @paulinashakirova

@elasticmachine

Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

cc @paulinashakirova

@mgadewoll mgadewoll left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 The changes are looking good and the update works as expected. Thanks for contributing, great work! 🎉

@paulinashakirova
paulinashakirova merged commit 6ad3db7 into elastic:main Sep 5, 2025
@paulinashakirova

Copy link
Copy Markdown
Author

🟢 The changes are looking good and the update works as expected. Thanks for contributing, great work! 🎉

🤩
@mgadewoll Thank you for all your suggestions and tips!

@paulinashakirova
paulinashakirova deleted the customise-tooltip-offset-optional-prop branch September 5, 2025 11:53
tkajtoch added a commit to elastic/kibana that referenced this pull request Sep 11, 2025
- `@elastic/eui`: `v106.4.0` ⏩ `v106.5.0`

[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)

## Package updates

## [`v106.5.0`](https://github.com/elastic/eui/releases/v106.5.0)

- Added an optional `offset` prop to `EuiToolTip` to allow customizing
the distance (in pixels) between the tooltip and its anchor.
([#8988](elastic/eui#8988))
- Updated `EuiDataGrid` hover styles when `stripes={true}` to ensure a
visible background color change on hover
([#8983](elastic/eui#8983))

**Bug fixes**

- Fixed a 1ms time shift on `EuiSuperDatePicker` when using the quick
select time window steps
([#8985](elastic/eui#8985))
- Fixed a visual issue in `EuiSuperDatePicker` with `isQuickSelectOnly`
enabled, where delimiter padding caused an unexpected empty container
([#8985](elastic/eui#8985))

**Accessibility**

- Changed the close button position in `EuiModal` to allow for the modal
title to be perceivable first
([#8954](elastic/eui#8954))
- Added screen reader hint text on `EuiModal` to indicate closing
behavior ([#8954](elastic/eui#8954))

---------

Co-authored-by: Elastic Machine <[email protected]>
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Sep 24, 2025
- `@elastic/eui`: `v106.4.0` ⏩ `v106.5.0`

[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)

## Package updates

## [`v106.5.0`](https://github.com/elastic/eui/releases/v106.5.0)

- Added an optional `offset` prop to `EuiToolTip` to allow customizing
the distance (in pixels) between the tooltip and its anchor.
([elastic#8988](elastic/eui#8988))
- Updated `EuiDataGrid` hover styles when `stripes={true}` to ensure a
visible background color change on hover
([elastic#8983](elastic/eui#8983))

**Bug fixes**

- Fixed a 1ms time shift on `EuiSuperDatePicker` when using the quick
select time window steps
([elastic#8985](elastic/eui#8985))
- Fixed a visual issue in `EuiSuperDatePicker` with `isQuickSelectOnly`
enabled, where delimiter padding caused an unexpected empty container
([elastic#8985](elastic/eui#8985))

**Accessibility**

- Changed the close button position in `EuiModal` to allow for the modal
title to be perceivable first
([elastic#8954](elastic/eui#8954))
- Added screen reader hint text on `EuiModal` to indicate closing
behavior ([elastic#8954](elastic/eui#8954))

---------

Co-authored-by: Elastic Machine <[email protected]>
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.

3 participants