Repository navigation
[EuiFlyoutMenu] Add pagination controls with previous/next buttons and counter - #9722
Conversation
2 visual difference(s) found - expand to review, then click Approve visual changes to update baselineseuipopover (1 difference)
euidatagrid (1 difference)
|
…n naming - Added `pagination` prop to `EuiFlyoutMenuProps` for Prev/Next navigation and position counter. - Implemented `setPagination(flyoutId, pagination)` in the flyout manager store for reactive updates. - Created `useFlyoutPagination(flyoutId)` hook for accessing pagination overrides. - Renamed `onPrev` to `onPrevious` in relevant components and tests for consistency.
There was a problem hiding this comment.
Pull request overview
Adds pagination (Prev/Next + counter) to the EuiFlyoutMenu menu bar and enables cross-root pagination updates for managed flyouts via the flyout manager store API.
Changes:
- Added
EuiFlyoutMenuProps.pagination/EuiFlyoutMenuPaginationand rendered pagination controls (Prev/Next +N of total) whentotal > 1. - Extended the flyout manager store with
setPagination, reducer support, and auseFlyoutPaginationselector hook;EuiManagedFlyoutmerges store + prop pagination with store precedence and a dev warning when both are set. - Added Storybook examples, Jest tests, and a changelog entry for the new API.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/eui/src/components/flyout/use_flyout_menu.ts | Treats pagination (total > 1) as menu “content” for auto-render decisions. |
| packages/eui/src/components/flyout/manager/types.ts | Adds pagination to managed flyout state and setPagination to the manager API typing. |
| packages/eui/src/components/flyout/manager/store.ts | Wires setPagination store method to dispatch the new action. |
| packages/eui/src/components/flyout/manager/store.test.ts | Adds store tests ensuring setPagination updates state and subscriber notifications behave as expected. |
| packages/eui/src/components/flyout/manager/selectors.ts | Adds useFlyoutPagination selector hook. |
| packages/eui/src/components/flyout/manager/reducer.ts | Implements ACTION_SET_PAGINATION reducer behavior (no-op on missing flyout or same ref). |
| packages/eui/src/components/flyout/manager/reducer.test.ts | Adds reducer coverage for setting/clearing/no-op pagination. |
| packages/eui/src/components/flyout/manager/index.ts | Re-exports the new action creator and selector hook. |
| packages/eui/src/components/flyout/manager/hooks.ts | Re-exports useFlyoutPagination from selectors. |
| packages/eui/src/components/flyout/manager/flyout_sessions.stories.tsx | Adds a cross-root pagination Storybook demo using the singleton store. |
| packages/eui/src/components/flyout/manager/flyout_managed.tsx | Merges store/prop pagination (store wins) and warns once if both are provided. |
| packages/eui/src/components/flyout/manager/flyout_managed.test.tsx | Updates mocks to include useFlyoutPagination. |
| packages/eui/src/components/flyout/manager/actions.ts | Adds ACTION_SET_PAGINATION and the setPagination action creator. |
| packages/eui/src/components/flyout/manager/mocks/index.ts | Extends manager mocks with a setPagination stub. |
| packages/eui/src/components/flyout/index.ts | Re-exports the new EuiFlyoutMenuPagination type from the flyout entrypoint. |
| packages/eui/src/components/flyout/flyout_menu.tsx | Defines pagination types and renders Prev/Next + counter with SR announcements. |
| packages/eui/src/components/flyout/flyout_menu.test.tsx | Adds pagination UI and interaction tests. |
| packages/eui/src/components/flyout/flyout_menu.styles.ts | Adds styling for the pagination counter text. |
| packages/eui/src/components/flyout/flyout_menu.stories.tsx | Adds a prop-based pagination Storybook story for overlay flyouts. |
| packages/eui/changelogs/upcoming/9722.md | Documents the new pagination props/store API and selector hook. |
Comments suppressed due to low confidence (1)
packages/eui/src/components/flyout/flyout_menu.tsx:371
- When pagination is active (
pagination.total > 1), the design/PR description says the left slot should show pagination instead of back button + history. The back button is suppressed, but the history popover still renders, so the UI can show pagination and history at the same time.
{pagination && pagination.total > 1 ? (
<PaginationControls pagination={pagination} styles={styles} />
) : (
showBackButton && (
<EuiFlexItem grow={false}>
<BackButton {...backButtonProps} />
</EuiFlexItem>
)
)}
{historyItems.length > 0 && (
<EuiFlexItem grow={false}>
<HistoryPopover items={historyItems} />
</EuiFlexItem>
)}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3 visual difference(s) found - expand to review, then click Approve visual changes to update baselineseuipopover (1 difference)
euidatagrid (2 differences)
|
- Introduced `pagination` prop to `EuiFlyoutMenuProps` for improved navigation with Previous/Next buttons and a position counter. - Updated button icons from `arrowUp`/`arrowDown` to `chevronSingleUp`/`chevronSingleDown` for better visual clarity. - Adjusted aria-labels for accessibility, changing from "Alert details" to "Item details". - Refactored pagination controls layout for better responsiveness and structure. - Added console warning for dual pagination sources to prevent confusion.
2 visual difference(s) found - expand to review, then click Approve visual changes to update baselineseuipopover (1 difference)
euidatagrid (1 difference)
|
- Enhanced `EuiFlyoutMenuProps` with a `pagination` prop for improved navigation, allowing for Previous/Next buttons and a position counter. - Updated flyout manager to conditionally hide the back button and history items when pagination is active. - Added a new documentation page for pagination usage in flyouts, including an interactive example. - Refactored related tests to ensure proper functionality of pagination controls.
2 visual difference(s) found - expand to review, then click Approve visual changes to update baselineseuicodeblock (1 difference)
euidatagrid (1 difference)
|
- Introduced new localization tokens for pagination controls: "Previous", "Next", and a position counter format. - Updated the i18ntokens.json file to include these new tokens for better internationalization support in the EuiFlyoutMenu component.
2 visual difference(s) found - expand to review, then click Approve visual changes to update baselineseuipopover (1 difference)
euidatagrid (1 difference)
|
There was a problem hiding this comment.
nit: These changes should be reverted. This file is updated automatically during release.
tkajtoch
left a comment
There was a problem hiding this comment.
The changes look great! I'm happy to approve when you revert the i18ntokens.json changes! 🎉
💔 Build Failed
Failed CI StepsHistory
|
💚 Build Succeeded
History
|
1 visual difference(s) found - expand to review, then click Approve visual changes to update baselineseuidatagrid (1 difference)
|












Summary
What: Adds Prev/Next pagination controls to
EuiFlyoutMenu— the menu bar rendered at the top of every flyout. Two consumption paths are supported:flyoutMenuProps.pagination) — the caller owns pagination state and passes{ currentIndex, total, onPrevious, onNext }directly. Works with both overlay and managed flyouts.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 (https://github.com/elastic/kibana-team/issues/3152). Reach out for the link)
How:
PaginationControlsis an internal component rendered in the left slot ofEuiFlyoutMenu. Per the design spec (see image below), the left slot holds either back-button + history or pagination — not both. Whenpagination.total > 1, pagination takes precedence and the back button is suppressed.setPaginationaction/reducer that silently no-ops for unregistered flyout IDs (overlay/unmanaged flyouts receive pagination via the prop instead).EuiManagedFlyoutmerges both sources with store-wins precedence (storePagination ?? propPagination). Using both simultaneously logs a dev warning.arrowUp/arrowDownper the design spec (vertical list/data navigation, not horizontal).aria-hidden="true"and duplicated insideEuiScreenReaderLivefor assistive technology.API Changes
EuiFlyoutMenupaginationEuiFlyoutMenuPagination— enables Prev/Next controls and a position counter (N of total) in the menu barEuiFlyoutMenuPagination{ currentIndex: number, total: number, onPrevious: () => void, onNext: () => void }— zero-based indexFlyoutManagerApisetPagination(flyoutId, pagination)EuiManagedFlyoutStatepaginationuseFlyoutPaginationmanager/index.ts)Screenshots
N of total/ Next ↓ in the menu bar left slotImpact Assessment
paginationprop is provided orsetPaginationis called. No change to existing flyout appearance.EuiFlyoutMenu(pagination block), reducer, store, and selectors. Snapshot baseline unchanged for existing tests.Impact level: 🟢 Low — purely additive, no changes to existing rendered output.
Release Readiness
EuiFlyoutMenuand "Cross-root pagination" in Flyout Manager.setPaginationAPI 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)
N of 5) and the flyout body content.total ≤ 1.Store-based / cross-root pagination — Storybook: Layout > EuiFlyout > Flyout Manager > Cross-root pagination
onPrevious/onNextcallbacks update the data grid root'scurrentIndex, which re-callssetPagination).Keyboard / accessibility
Checklist before marking Ready for Review
flyout_menu.test.tsx, reducer, store, selectors)packages/eui/changelogs/upcoming/9722.md)Reviewer checklist
Design