Skip to content

[EuiTable/EuiBasicTable/EuiInMemoryTable] Add sticky table headers - #9682

Merged
tkajtoch merged 39 commits into
elastic:mainfrom
tkajtoch:feat/tables-sticky-header
Jun 1, 2026
Merged

tkajtoch merged 39 commits into
elastic:mainfrom
tkajtoch:feat/tables-sticky-header

Conversation

@tkajtoch

@tkajtoch tkajtoch commented May 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Resolves #9619

This PR adds support for table sticky headers. They can be activated by setting stickyHeader = true on <EuiTable>, <EuiBasicTable> or <EuiInMemoryTable>. It's marked as experimental, but the implementation is production-ready and doesn't have any (major) performance bottlenecks.

Implementation details:

  • Sticky header is rendered as a separate <table> due to browser compatibility issues. There was a recent decision made on per-axis scroll tracking that would make this implementation obsolete, but it's not currently available in any browsers on our support list. An experimental support was added in Chromium via experimental web platform features feature flag (issue), but it looks like it's going to be a while until this reaches GA.
  • There's a new EuiTableStore that feeds the sticky header implementation in <EuiTableStickyHeader>.
  • <EuiTableHeaderCell> and <EuiTableHeaderCellCheckbox> register rendered columns in the store and update it whenever the column itself or its width change. This is achieved with a ref render function, which has access to all props and is scalable, reducing the synchronization and maintenance cost even though it looks a little strange at first sight
  • <EuiTableStickyHeader> tracks the position of the original table and programmatically updates its scroll position to match the layout of the original table header

API Changes

component / parent prop / child change description
EuiTable, EuiBasicTable, EuiInMemoryTable stickyHeader Added Enable the sticky header behavior. When enabled, the table header will float on top of the viewport while scrolling through table contents.

Screenshots

Before After
Screen.Recording.2026-05-29.at.14.20.45.mov
Screen.Recording.2026-05-29.at.14.23.35.mov

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: 🟢 Low to none

Release Readiness

QA instructions for reviewer

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.

@tkajtoch tkajtoch self-assigned this May 27, 2026
@tkajtoch

Copy link
Copy Markdown
Contributor Author

This PR is marked as draft because I'm lacking unit tests. All functionality is (more or less) final

@tkajtoch tkajtoch changed the title [EuiTable/EuiBasicTable/EuiInMemoryTable] Sticky table headers [EuiTable/EuiBasicTable/EuiInMemoryTable] Add sticky table headers May 28, 2026
@tkajtoch

tkajtoch commented May 29, 2026 •

Copy link
Copy Markdown
Contributor Author

I found a bug in intersection detection logic that prevents the header from showing when opened in the Storybook iframe. It works as expected when opened directly: https://eui.elastic.co/pr_9682/storybook/iframe.html?args=&globals=&showSnippet=undefined&id=tabular-content-euibasictable--scrollable&viewMode=story

I'm going to address it shortly.

Edit: Fixed in 1588c06

@tkajtoch
tkajtoch marked this pull request as ready for review May 29, 2026 12:26
@tkajtoch
tkajtoch requested a review from a team as a code owner May 29, 2026 12:26
@tkajtoch
tkajtoch requested a review from acstll May 29, 2026 12:30
`,
scrollableWrapper: css`
overflow-inline: auto;
overscroll-behavior-inline: none;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is to prevent table overscroll on the horizontal axis, mainly on MacOS. It makes the table synchronization look significantly better, as it's not possible to read the overscroll state and simulate the same look and feel on the sticky header. It is a change to all tables, but considering that almost no tables are scrollable at this time, it's not going to be noticed by users.

@acstll acstll 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.

🟢 I could have used a bit more time to read the code more carefully, but since this is experimental and opt-in, I think it's safe to merge — I tried breaking it and also followed the QA guide. It works pretty well and as expected. (I tried different browsers and also on Windows.)

I left a couple of nits regarding docs and code comments. We could ignore them but these are hard to get back to… 🙂

One extra thought to consider: if I'm not mistaken, the header duplication logic is needed because position: sticky does not yet support both vertical and horizontal axes… so the logic is only needed whenever the prop scrollableInline=true is passed… would it make sense to use the complex duplication logic exclusively when scrollableInline=true and otherwise fallback to the position: sticky technique? or would that make things even more complex?

@tkajtoch

tkajtoch commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

One extra thought to consider: if I'm not mistaken, the header duplication logic is needed because position: sticky does not yet support both vertical and horizontal axes… so the logic is only needed whenever the prop scrollableInline=true is passed… would it make sense to use the complex duplication logic exclusively when scrollableInline=true and otherwise fallback to the position: sticky technique? or would that make things even more complex?

Great question! I thought of it and the reason why I left it as-is is because scrollableInline=true will become the default in short term and we plan to enable it globally in Kibana, and that this whole stickiness is not the easiest to support and handle right. When you introduce branches to a logic like that it feels like it's way easier to break or miss something.

When it comes to performance, the synchronization logic is pretty lightweight as well when scrollableInline is false - scroll isn't called, which is probably the most resource-intensive operation this code does.

That being said, I agree with your point and I'm really happy you're pointing this out! Let me create an issue for it as an optimization step and see if we could indeed benefit from this!

@tkajtoch
tkajtoch enabled auto-merge (squash) June 1, 2026 09:28
@elasticmachine

Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

cc @tkajtoch

@tkajtoch
tkajtoch merged commit 36e169a into elastic:main Jun 1, 2026
1 check passed
@elasticmachine

Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

cc @tkajtoch

JasonStoltz pushed a commit to elastic/kibana that referenced this pull request Jun 24, 2026
## Dependency updates

`@elastic/eui` - v116.2.0 ⏩ v116.3.1
`@elastic/eslint-plugin-eui` - v2.13.0 ⏩ v2.14.0

## Package updates

### `@elastic/eui`
[v116.3.1](https://github.com/elastic/eui/blob/main/packages/eui/changelogs/CHANGELOG_2026.md)

**Bug fixes**

- Fixed `EuiTableHeaderCell` and `EuiTableHeaderCellCheckbox` throwing
an error in Jest test environments due to static mocking of
`useGeneratedHtmlId` by generating a stable, unique key with `uuidv4`
([#9698](elastic/eui#9698))
- Fixed an issue where the tooltip anchor wrapper in `EuiAvatar` did not
have the same `border-radius` applied as the avatar itself.
([#9697](elastic/eui#9697))


### `@elastic/eui`
[v116.3.0](https://github.com/elastic/eui/blob/main/packages/eui/changelogs/CHANGELOG_2026.md)

- Added `EuiBanner` component
([#9673](elastic/eui#9673))
- Replaced native browser `title` attributes with `EuiToolTip` across
the following components for consistent tooltips:
([#9643](elastic/eui#9643))
  - `EuiAvatar`
  - `EuiBasicTable`
  - `EuiBreadcrumbs`
  - `EuiComboBox`
  - `EuiDataGrid`
  - `EuiAutoRefresh`
  - `EuiSuperDatePicker`
  - `EuiFieldPassword`
  - `EuiMarkdownEditor`
  - `EuiPagination`
  - `EuiSearchBar`
  - `EuiSelectable`
  - `EuiTextTruncate`
- Extended `EuiToolTip`'s `display` prop to support `"flex"`
([#9643](elastic/eui#9643))
- Added experimental support for sticky headers in `EuiTable`,
`EuiBasicTable` and `EuiInMemoryTable`
([#9682](elastic/eui#9682))

**Bug fixes**

- Fixed `direction="row"` not applying on `EuiSplitPanel.Outer` when
`onClick` was set. ([#9693](elastic/eui#9693))
- Fixed `EuiDatePicker` firing `onChange` with an out-of-bounds date
when navigating to a month or year via the dropdowns while `minDate` or
`maxDate` is set ([#9685](elastic/eui#9685))
- Fixed a visual issue on `EuiPanel` where panels with `onClick` would
render with a `height` difference of `1px`.
([#9694](elastic/eui#9694))
- Fixed an issue in `EuiSelectable` and `EuiComboBox` where interactive
content in group labels wasn't clickable due to overlapping content.
([#9678](elastic/eui#9678))
### `@elastic/eslint-plugin-eui`
[v2.14.0](https://github.com/elastic/eui/blob/main/packages/eslint-plugin/changelogs/CHANGELOG_2026.md)

- Removed auto-fix from `tooltip-button-icon-wrap` rule
([#9695](elastic/eui#9695))

---------

Co-authored-by: Tomasz Kajtoch <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Lene Gadewoll <[email protected]>
patrykkopycinski pushed a commit to patrykkopycinski/kibana that referenced this pull request Aug 5, 2026
## Dependency updates

`@elastic/eui` - v116.2.0 ⏩ v116.3.1
`@elastic/eslint-plugin-eui` - v2.13.0 ⏩ v2.14.0

## Package updates

### `@elastic/eui`
[v116.3.1](https://github.com/elastic/eui/blob/main/packages/eui/changelogs/CHANGELOG_2026.md)

**Bug fixes**

- Fixed `EuiTableHeaderCell` and `EuiTableHeaderCellCheckbox` throwing
an error in Jest test environments due to static mocking of
`useGeneratedHtmlId` by generating a stable, unique key with `uuidv4`
([elastic#9698](elastic/eui#9698))
- Fixed an issue where the tooltip anchor wrapper in `EuiAvatar` did not
have the same `border-radius` applied as the avatar itself.
([elastic#9697](elastic/eui#9697))


### `@elastic/eui`
[v116.3.0](https://github.com/elastic/eui/blob/main/packages/eui/changelogs/CHANGELOG_2026.md)

- Added `EuiBanner` component
([elastic#9673](elastic/eui#9673))
- Replaced native browser `title` attributes with `EuiToolTip` across
the following components for consistent tooltips:
([elastic#9643](elastic/eui#9643))
  - `EuiAvatar`
  - `EuiBasicTable`
  - `EuiBreadcrumbs`
  - `EuiComboBox`
  - `EuiDataGrid`
  - `EuiAutoRefresh`
  - `EuiSuperDatePicker`
  - `EuiFieldPassword`
  - `EuiMarkdownEditor`
  - `EuiPagination`
  - `EuiSearchBar`
  - `EuiSelectable`
  - `EuiTextTruncate`
- Extended `EuiToolTip`'s `display` prop to support `"flex"`
([elastic#9643](elastic/eui#9643))
- Added experimental support for sticky headers in `EuiTable`,
`EuiBasicTable` and `EuiInMemoryTable`
([elastic#9682](elastic/eui#9682))

**Bug fixes**

- Fixed `direction="row"` not applying on `EuiSplitPanel.Outer` when
`onClick` was set. ([elastic#9693](elastic/eui#9693))
- Fixed `EuiDatePicker` firing `onChange` with an out-of-bounds date
when navigating to a month or year via the dropdowns while `minDate` or
`maxDate` is set ([elastic#9685](elastic/eui#9685))
- Fixed a visual issue on `EuiPanel` where panels with `onClick` would
render with a `height` difference of `1px`.
([elastic#9694](elastic/eui#9694))
- Fixed an issue in `EuiSelectable` and `EuiComboBox` where interactive
content in group labels wasn't clickable due to overlapping content.
([elastic#9678](elastic/eui#9678))
### `@elastic/eslint-plugin-eui`
[v2.14.0](https://github.com/elastic/eui/blob/main/packages/eslint-plugin/changelogs/CHANGELOG_2026.md)

- Removed auto-fix from `tooltip-button-icon-wrap` rule
([elastic#9695](elastic/eui#9695))

---------

Co-authored-by: Tomasz Kajtoch <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Lene Gadewoll <[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.

[EuiTable/EuiBasicTable/EuiInMemoryTable] Add sticky table headers

3 participants