Skip to content

[EuiFlyoutMenu] Add pagination controls with previous/next buttons and counter V2 - #9726

Merged
paulinashakirova merged 6 commits into
elastic:mainfrom
paulinashakirova:flyout-pagination-v2
Jun 18, 2026
Merged

paulinashakirova merged 6 commits into
elastic:mainfrom
paulinashakirova:flyout-pagination-v2

Conversation

@paulinashakirova

@paulinashakirova paulinashakirova commented Jun 18, 2026 •

Copy link
Copy Markdown

Summary

What: Adds Prev/Next pagination controls to EuiFlyoutMenu — the menu bar rendered at the top of every flyout. Two consumption paths are supported:

  1. Prop-based (flyoutMenuProps.pagination) — the caller owns pagination state and passes { currentIndex, total, onPrevious, onNext } directly. Works with both overlay and managed flyouts.
  2. Store-based (getFlyoutManagerStore().setPagination(flyoutId, pagination)) — a separate React root (e.g. a data grid or list mounted independently) pushes pagination state into the flyout manager singleton without needing shared React context. The managed flyout reads and displays it automatically.

Why: A common pattern in complex UIs is a list (table, data grid, search results) paired with a detail flyout — users expect to step through items without closing and reopening the flyout. When list and flyout share a React tree the prop-based path covers this. When they live in separate React roots (e.g. independently mounted micro-frontends or portals), the store-based path lets the list push navigation state into the flyout manager without shared context or prop drilling.
(There is a corresponding Epic on Kibana's side (#3152). Reach out for the link)

How:

  • PaginationControls is an internal component rendered in the left slot of EuiFlyoutMenu. Per the design spec (see image below), the left slot holds either back-button + history or pagination — not both. When pagination.total > 1, pagination takes precedence and the back button is suppressed.
  • The flyout manager store gains a setPagination action/reducer that silently no-ops for unregistered flyout IDs (overlay/unmanaged flyouts receive pagination via the prop instead).
  • EuiManagedFlyout merges both sources with store-wins precedence (storePagination ?? propPagination). Using both simultaneously logs a dev warning.
  • Icons use arrowUp / arrowDown per the design spec (vertical list/data navigation, not horizontal).
  • Counter is visually rendered with aria-hidden="true" and duplicated inside EuiScreenReaderLive for assistive technology.

API Changes

component / parent prop / child change description
EuiFlyoutMenu pagination Added EuiFlyoutMenuPagination — enables Prev/Next controls and a position counter (N of total) in the menu bar
EuiFlyoutMenuPagination — Added (new type) { currentIndex: number, total: number, onPrevious: () => void, onNext: () => void } — zero-based index
FlyoutManagerApi setPagination(flyoutId, pagination) Added Cross-root store API; silent no-op for unmanaged/overlay flyouts
EuiManagedFlyoutState pagination Added Persists pagination state per flyout in the manager store
useFlyoutPagination — Added (new hook, manager/index.ts) Selector hook to read current pagination for a given flyout ID

Screenshots

Screenshot 2026-06-16 at 16 56 43 Screenshot 2026-06-16 at 16 57 06
Before After
No navigation controls in flyout menu bar Prev ↑ / N of total / Next ↓ in the menu bar left slot

Impact Assessment

  • 🔴 Breaking changes — None. All new API surface; existing flyouts are unaffected.
  • 💅 Visual changes — New UI elements appear only when pagination prop is provided or setPagination is called. No change to existing flyout appearance.
  • 🧪 Test impact — New Jest tests added for EuiFlyoutMenu (pagination block), reducer, store, and selectors. Snapshot baseline unchanged for existing tests.
  • 🔧 Hard to integrate — No changes are required to adopt; the store API is additive.

Impact level: 🟢 Low — purely additive, no changes to existing rendered output.

Release Readiness

  • Documentation: Covered by Storybook stories — "Pagination (prop-based)" in EuiFlyoutMenu and "Cross-root pagination" in Flyout Manager.
  • Design: Follows existing flyout-menu design spec.
  • Migration guide: N/A — no breaking changes or deprecations.
  • Adoption plan: Targets any list-plus-detail-flyout pattern. The store-based setPagination API is designed for consumers where the list and flyout live in separate React roots.

QA instructions for reviewer

Prop-based pagination — Storybook: Layout > EuiFlyout > EuiFlyoutMenu > Pagination (prop-based)

  • Prev (↑) button is disabled on the first item; Next (↓) button is disabled on the last item.
  • Clicking Prev/Next updates the counter (N of 5) and the flyout body content.
  • A screen reader announces the counter on each navigation (use VoiceOver or NVDA — should announce once, not twice).
  • The back button is not rendered when pagination is active.
  • No pagination controls appear when total ≤ 1.

Store-based / cross-root pagination — Storybook: Layout > EuiFlyout > Flyout Manager > Cross-root pagination

  • The "Data grid (separate React root)" rows and the flyout menu bar Prev/Next stay in sync.
  • Clicking a row in the data grid updates the flyout body to the corresponding item and moves the counter.
  • Using Prev/Next in the flyout menu bar updates the flyout body (the onPrevious/onNext callbacks update the data grid root's currentIndex, which re-calls setPagination).
  • Closing and re-opening the flyout resets cleanly (no stale pagination state).

Keyboard / accessibility

  • Both Prev and Next buttons are reachable and activatable by keyboard.
  • When at the first or last item, the corresponding navigation button is visually disabled and removed from the tab order.
  • Counter is not double-announced.

Checklist before marking Ready for Review

  • Filled out all sections above
  • QA: Tested light/dark modes, high contrast, mobile, Chrome/Safari/Firefox, keyboard-only, screen reader
  • QA: Tested in ~~CodeSandbox~ (new API surface — testable post-publish) and Kibana
  • QA: Tested docs changes
  • Tests: Added/updated Jest tests (pagination in flyout_menu.test.tsx, reducer, store, selectors)
  • Changelog: Added changelog entry (packages/eui/changelogs/upcoming/9722.md)
  • Breaking changes: N/A

Reviewer checklist

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

Design

Screenshot 2026-06-16 at 22 18 12

@paulinashakirova paulinashakirova changed the title [EuiFlyoutMenu] Add pagination controls with previous/next buttons and counter [EuiFlyoutMenu] Add pagination controls with previous/next buttons and counter V2 Jun 18, 2026
@paulinashakirova paulinashakirova self-assigned this Jun 18, 2026
@paulinashakirova
paulinashakirova marked this pull request as ready for review June 18, 2026 11:15
@paulinashakirova
paulinashakirova requested a review from a team as a code owner June 18, 2026 11:15
Copilot AI review requested due to automatic review settings June 18, 2026 11:15

Copilot AI 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.

Pull request overview

Adds pagination controls to EuiFlyoutMenu and introduces a flyout-manager store API to support cross-React-root pagination state, enabling Prev/Next navigation and an N of total counter in flyout menu bars.

Changes:

  • Added flyoutMenuProps.pagination (with Prev/Next controls + counter) to EuiFlyoutMenu
  • Added flyout manager setPagination() action/store support + useFlyoutPagination() selector hook
  • Added docs, Storybook examples (prop-based + cross-root), and Jest coverage for reducer/store/menu UI

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/website/docs/components/containers/flyout/_flyout_menu.mdx Embeds new pagination docs section into flyout menu documentation
packages/website/docs/components/containers/flyout/_flyout_menu_pagination.mdx New MDX example/docs for flyoutMenuProps.pagination
packages/eui/src/components/flyout/use_flyout_menu.ts Treats pagination as “menu has meaningful content” when total > 1
packages/eui/src/components/flyout/manager/types.ts Persists pagination config on managed flyout state + exposes API type
packages/eui/src/components/flyout/manager/store.ts Adds setPagination() dispatch wrapper to the manager store
packages/eui/src/components/flyout/manager/store.test.ts Tests store setPagination() behavior and subscriber notifications
packages/eui/src/components/flyout/manager/selectors.ts Adds useFlyoutPagination() selector
packages/eui/src/components/flyout/manager/reducer.ts Adds reducer case for ACTION_SET_PAGINATION
packages/eui/src/components/flyout/manager/reducer.test.ts Adds reducer unit tests for pagination set/clear/no-op behavior
packages/eui/src/components/flyout/manager/index.ts Re-exports setPaginationAction and useFlyoutPagination
packages/eui/src/components/flyout/manager/hooks.ts Re-exports useFlyoutPagination via the hooks barrel
packages/eui/src/components/flyout/manager/flyout_sessions.stories.tsx Adds “Cross-root pagination” Storybook example using the singleton store
packages/eui/src/components/flyout/manager/flyout_managed.tsx Merges store vs prop pagination (store wins) and suppresses back/history UI
packages/eui/src/components/flyout/manager/flyout_managed.test.tsx Updates mocks to include the new useFlyoutPagination hook
packages/eui/src/components/flyout/manager/actions.ts Adds ACTION_SET_PAGINATION + setPagination() action creator
packages/eui/src/components/flyout/manager/mocks/index.ts Extends manager mocks with setPagination
packages/eui/src/components/flyout/index.ts Re-exports EuiFlyoutMenuPagination type
packages/eui/src/components/flyout/flyout_menu.tsx Implements pagination UI (Prev/Next + counter + SR live announcement)
packages/eui/src/components/flyout/flyout_menu.test.tsx Adds Jest tests for pagination rendering/disabled states/callbacks
packages/eui/src/components/flyout/flyout_menu.styles.ts Adds styling for the pagination counter
packages/eui/src/components/flyout/flyout_menu.stories.tsx Adds prop-based pagination Storybook example
packages/eui/changelogs/upcoming/9722.md Adds changelog entry documenting the new API surface

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

Comment on lines +228 to +233
const prevButton = (
<EuiButtonIcon
iconType="chevronSingleUp"
color="text"
size="xs"
aria-label={prevLabel}

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.

@paulinashakirova I'll let you handle this one because I don't know what are the design requirements.

@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
2 visual difference(s) found - expand to review, then click Approve visual changes to update baselines

euidatagrid (2 differences)

StoryBeforeAfterDiff
compact desktop
additional controls options desktop

@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
2 visual difference(s) found - expand to review, then click Approve visual changes to update baselines

euipopover (1 difference)

StoryBeforeAfterDiff
playground desktop

euidatagrid (1 difference)

StoryBeforeAfterDiff
additional controls options desktop

@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
2 visual difference(s) found - expand to review, then click Approve visual changes to update baselines

euipopover (1 difference)

StoryBeforeAfterDiff
playground desktop

euidatagrid (1 difference)

StoryBeforeAfterDiff
additional controls options desktop

@paulinashakirova

Copy link
Copy Markdown
Author

buildkite test this

@paulinashakirova paulinashakirova added the skip-vrt Skips Visual Regression Testing job in CI (clearly state why you're using it in your PR) label Jun 18, 2026
@paulinashakirova

Copy link
Copy Markdown
Author

buildkite test this

@elasticmachine

Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

cc @paulinashakirova

@paulinashakirova
paulinashakirova merged commit d37fe0e into elastic:main Jun 18, 2026
3 checks passed
@elasticmachine

Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

cc @paulinashakirova

@paulinashakirova
paulinashakirova deleted the flyout-pagination-v2 branch June 18, 2026 15:35
@weronikaolejniczak weronikaolejniczak mentioned this pull request Jun 19, 2026
7 of 10 tasks
weronikaolejniczak added a commit to elastic/kibana that referenced this pull request Jul 2, 2026
## Dependency updates

`@elastic/eui` - v116.3.1 ⏩ v116.5.0

## Package updates

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

- Added `logoVectorDB` icon glyph
([#9758](elastic/eui#9758))
- Updated logo glyphs to use pure white in dark mode
([#9758](elastic/eui#9758))

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

- Added `pagination` prop to `EuiFlyoutMenuProps`
(`EuiFlyoutMenuPagination`) that renders Previous/Next navigation
buttons and a position counter in the flyout menu bar. When provided,
the back button is hidden — pagination and back button are mutually
exclusive. ([#9726](elastic/eui#9726))
- Added `setPagination(flyoutId, pagination)` to the flyout manager
store (`getFlyoutManagerStore()`) and `setPaginationAction` action
creator. Calling `setPagination` overrides any declarative
`flyoutMenuProps.pagination` and re-renders the menu bar reactively
across React roots — useful for imperatively opened flyouts that mount
in a separate root and can't update props through normal React
reconciliation. ([#9726](elastic/eui#9726))
- Added `useFlyoutPagination(flyoutId)` selector hook that returns the
manager-level pagination override for a flyout, if any.
([#9726](elastic/eui#9726))
- Added a new optional `panelled` prop (boolean, defaults to `false`) to
`EuiInMemoryTable` and `EuiBasicTable` that enables the panelled layout
([#9717](elastic/eui#9717))
- Added `useEuiBasicTablePanelProps` utility hook that provides props
and styles necessary to create custom table panels such as toolbars
([#9717](elastic/eui#9717))
- Added an optional `meta` argument to `EuiFlyout`'s `onClose` callback
(`onClose(event, { reason })`) describing why the flyout closed:
`'close-button'`, `'escape'`, `'outside-click'`, and, for managed
flyouts, `'navigation-back'` (Back button) or `'navigation-cascade'`
(parent navigated away / main flyout closed)
([#9716](elastic/eui#9716))
- Updated `EuiBanner` by removing the render condition for secondary
actions ([#9713](elastic/eui#9713))
- Updated `EuiBanner` to adjust spacing for content passed via the
`children` prop ([#9700](elastic/eui#9700))
- Updated `EuiToast` styles
([#9688](elastic/eui#9688))
- Added `text` prop on `EuiToast` which renders the main text. Use this
instead of `children` where possible.
([#9688](elastic/eui#9688))
- Added `actionProps` prop on `EuiToast` which renders primary and
secondary action buttons.
([#9688](elastic/eui#9688))
- Added `animationMs` prop on `EuiToast`. If set it'll render a reverse
loading bar. ([#9688](elastic/eui#9688))
- Added `showNotificationBadge` prop on `EuiGlobalToastList` to
optionally show a badge indicating the toast list length.
([#9688](elastic/eui#9688))

---------

Co-authored-by: Weronika Olejniczak <[email protected]>
MykhailoKondrat pushed a commit to MykhailoKondrat/kibana that referenced this pull request Jul 2, 2026
## Dependency updates

`@elastic/eui` - v116.3.1 ⏩ v116.5.0

## Package updates

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

- Added `logoVectorDB` icon glyph
([elastic#9758](elastic/eui#9758))
- Updated logo glyphs to use pure white in dark mode
([elastic#9758](elastic/eui#9758))

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

- Added `pagination` prop to `EuiFlyoutMenuProps`
(`EuiFlyoutMenuPagination`) that renders Previous/Next navigation
buttons and a position counter in the flyout menu bar. When provided,
the back button is hidden — pagination and back button are mutually
exclusive. ([elastic#9726](elastic/eui#9726))
- Added `setPagination(flyoutId, pagination)` to the flyout manager
store (`getFlyoutManagerStore()`) and `setPaginationAction` action
creator. Calling `setPagination` overrides any declarative
`flyoutMenuProps.pagination` and re-renders the menu bar reactively
across React roots — useful for imperatively opened flyouts that mount
in a separate root and can't update props through normal React
reconciliation. ([elastic#9726](elastic/eui#9726))
- Added `useFlyoutPagination(flyoutId)` selector hook that returns the
manager-level pagination override for a flyout, if any.
([elastic#9726](elastic/eui#9726))
- Added a new optional `panelled` prop (boolean, defaults to `false`) to
`EuiInMemoryTable` and `EuiBasicTable` that enables the panelled layout
([elastic#9717](elastic/eui#9717))
- Added `useEuiBasicTablePanelProps` utility hook that provides props
and styles necessary to create custom table panels such as toolbars
([elastic#9717](elastic/eui#9717))
- Added an optional `meta` argument to `EuiFlyout`'s `onClose` callback
(`onClose(event, { reason })`) describing why the flyout closed:
`'close-button'`, `'escape'`, `'outside-click'`, and, for managed
flyouts, `'navigation-back'` (Back button) or `'navigation-cascade'`
(parent navigated away / main flyout closed)
([elastic#9716](elastic/eui#9716))
- Updated `EuiBanner` by removing the render condition for secondary
actions ([elastic#9713](elastic/eui#9713))
- Updated `EuiBanner` to adjust spacing for content passed via the
`children` prop ([elastic#9700](elastic/eui#9700))
- Updated `EuiToast` styles
([elastic#9688](elastic/eui#9688))
- Added `text` prop on `EuiToast` which renders the main text. Use this
instead of `children` where possible.
([elastic#9688](elastic/eui#9688))
- Added `actionProps` prop on `EuiToast` which renders primary and
secondary action buttons.
([elastic#9688](elastic/eui#9688))
- Added `animationMs` prop on `EuiToast`. If set it'll render a reverse
loading bar. ([elastic#9688](elastic/eui#9688))
- Added `showNotificationBadge` prop on `EuiGlobalToastList` to
optionally show a badge indicating the toast list length.
([elastic#9688](elastic/eui#9688))

---------

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

`@elastic/eui` - v116.3.1 ⏩ v116.5.0

## Package updates

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

- Added `logoVectorDB` icon glyph
([elastic#9758](elastic/eui#9758))
- Updated logo glyphs to use pure white in dark mode
([elastic#9758](elastic/eui#9758))

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

- Added `pagination` prop to `EuiFlyoutMenuProps`
(`EuiFlyoutMenuPagination`) that renders Previous/Next navigation
buttons and a position counter in the flyout menu bar. When provided,
the back button is hidden — pagination and back button are mutually
exclusive. ([elastic#9726](elastic/eui#9726))
- Added `setPagination(flyoutId, pagination)` to the flyout manager
store (`getFlyoutManagerStore()`) and `setPaginationAction` action
creator. Calling `setPagination` overrides any declarative
`flyoutMenuProps.pagination` and re-renders the menu bar reactively
across React roots — useful for imperatively opened flyouts that mount
in a separate root and can't update props through normal React
reconciliation. ([elastic#9726](elastic/eui#9726))
- Added `useFlyoutPagination(flyoutId)` selector hook that returns the
manager-level pagination override for a flyout, if any.
([elastic#9726](elastic/eui#9726))
- Added a new optional `panelled` prop (boolean, defaults to `false`) to
`EuiInMemoryTable` and `EuiBasicTable` that enables the panelled layout
([elastic#9717](elastic/eui#9717))
- Added `useEuiBasicTablePanelProps` utility hook that provides props
and styles necessary to create custom table panels such as toolbars
([elastic#9717](elastic/eui#9717))
- Added an optional `meta` argument to `EuiFlyout`'s `onClose` callback
(`onClose(event, { reason })`) describing why the flyout closed:
`'close-button'`, `'escape'`, `'outside-click'`, and, for managed
flyouts, `'navigation-back'` (Back button) or `'navigation-cascade'`
(parent navigated away / main flyout closed)
([elastic#9716](elastic/eui#9716))
- Updated `EuiBanner` by removing the render condition for secondary
actions ([elastic#9713](elastic/eui#9713))
- Updated `EuiBanner` to adjust spacing for content passed via the
`children` prop ([elastic#9700](elastic/eui#9700))
- Updated `EuiToast` styles
([elastic#9688](elastic/eui#9688))
- Added `text` prop on `EuiToast` which renders the main text. Use this
instead of `children` where possible.
([elastic#9688](elastic/eui#9688))
- Added `actionProps` prop on `EuiToast` which renders primary and
secondary action buttons.
([elastic#9688](elastic/eui#9688))
- Added `animationMs` prop on `EuiToast`. If set it'll render a reverse
loading bar. ([elastic#9688](elastic/eui#9688))
- Added `showNotificationBadge` prop on `EuiGlobalToastList` to
optionally show a badge indicating the toast list length.
([elastic#9688](elastic/eui#9688))

---------

Co-authored-by: Weronika Olejniczak <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-vrt Skips Visual Regression Testing job in CI (clearly state why you're using it in your PR)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants