Skip to content

Conversation

@tsullivan
Copy link
Member

@tsullivan tsullivan commented Jun 9, 2025

EuiFlyoutChild: A Secondary "Child" Flyout with Dynamic Responsive Stacking

This PR introduces the EuiFlyoutChild component, a new addition to the EUI flyout system, designed to allow for side-by-side (grouped) flyout panels.

Screenshots

Responsive behavior

child-flyout-responsive-stacking-no-animation

Stateful custom hook

child-flyout-stateful-custom-hook

Feature Overview

The EuiFlyoutChild component enables a secondary flyout panel to be opened adjacent to a primary EuiFlyout.

Key Behaviors:

  1. Side-by-Side Layout: On wider viewports, the child flyout appears to the left edge of its parent EuiFlyout.
  2. Stacked Layout: On narrower viewports, the child flyout stacks on top of its parent, occupying the full width of the parent.
  3. Dynamic Stacking Breakpoint: The transition point between side-by-side and stacked layouts is dynamically calculated based on the combined widths of the parent and child flyouts.
    • The stacking breakpoint is the sum of the parent flyout's effective width and the child flyout's effective width.
    • For example:
      • If Parent is size 'm' and Child is size 's', the breakpoint is theme.breakpoint.m + theme.breakpoint.s.
      • If Parent is size 's' and Child is size 's', the breakpoint is theme.breakpoint.s + theme.breakpoint.s.
  4. Size Restrictions:
    • EuiFlyoutChild supports sizes 's' (small) and 'm' (medium).
    • If the parent EuiFlyout is size 'm', the EuiFlyoutChild can only be size 's'.
    • If the parent EuiFlyout is size 's', the EuiFlyoutChild can be size 's' or 'm'.

Implementation Details

  • Component Structure (eui_flyout_child.tsx):
    • Manages its own responsive logic by listening to window resize events to get the current viewport width (window.innerWidth).
    • Calculates the stackingBreakpointValue (numeric pixel value) by summing the theme-defined pixel widths corresponding to the parent's and child's sizes.
    • Determines isAboveStackingBreakpoint (boolean) by comparing window.innerWidth to stackingBreakpointValue. This state variable controls whether to apply side-by-side or stacked positioning styles.
  • Context Usage:
    • Uses EuiFlyoutContext to get the size of the parent EuiFlyout.
  • Validation:
    • Ensures EuiFlyoutChild is used within an EuiFlyout.
    • Requires an EuiFlyoutBody as a child.
    • Enforces the size restriction (parent 'm' cannot have child 'm').

State Management system

This PR adds a state management system for programmatically controlling flyouts (EuiFlyoutSessionProvider). It provides a flexible way to open, close, and manage the content of flyouts from anywhere within a React component tree.

This system is ideal for scenarios flows involving sequence of flyouts (e.g., a main flyout that opens a child flyout, a main flyout opens a "next" flyout), otherwise known as a "flyout session".

QA

Remove or strikethrough items that do not apply to your PR.

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)

@tsullivan tsullivan changed the title Flyout child Add EuiFlyoutChild component Jun 9, 2025
@tsullivan tsullivan changed the title Add EuiFlyoutChild component Add EuiFlyoutChild for Grouped Flyouts Jun 9, 2025
@tkajtoch tkajtoch self-requested a review June 10, 2025 11:47
@tsullivan tsullivan self-assigned this Jun 10, 2025
@tsullivan tsullivan marked this pull request as ready for review June 20, 2025 23:14
@tsullivan tsullivan requested a review from a team as a code owner June 20, 2025 23:14
@ryankeairns ryankeairns self-requested a review June 24, 2025 16:53
@tkajtoch
Copy link
Member

I'm in the process of reviewing this work

@tsullivan
Copy link
Member Author

Dug a little deeper. This seems to have to do with the max-inline-size for the child flyout.

@ryankeairns thanks for the detailed explanation! This has been fixed in f12ba50

@ryankeairns
Copy link
Contributor

Tested locally, the fix lgtm. Thanks!

Copy link
Contributor

@ryankeairns ryankeairns left a comment

Choose a reason for hiding this comment

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

Approving knowing there is more to do (e.g. add something like a fill). Great progress!

Copy link
Member

@tkajtoch tkajtoch left a comment

Choose a reason for hiding this comment

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

LGTM; Let's not keep it in review longer than necessary. I'm happy with the current shape of this PR

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @tsullivan

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @tsullivan

Copy link
Contributor

@ThomThomson ThomThomson left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for tagging me for review on this! I ran it locally clicked around, and looked through the code to understand how the state management is done.

@tkajtoch tkajtoch merged commit 726cad0 into elastic:main Jun 30, 2025
5 checks passed
acstll added a commit to elastic/kibana that referenced this pull request Jul 14, 2025
`104.1.0` ⏩ `105.0.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

### `@elastic/eui`

#### [`v105.0.0`](https://github.com/elastic/eui/releases/v105.0.0)

- Added marked row styling via the classes `euiDataGridRow--marked` and
`euiTableRow--marked` for `EuiDataGrid` and `EuiBasicTable`
([#8834](elastic/eui#8834))
- Added component tokens:
([#8834](elastic/eui#8834))
  - `dataGridRowBackgroundMarked`
  - `dataGridRowBackgroundMarkedHover`
  - `dataGridRowBorderActive`
  - `dataGridRowBorderHover`
  - `dataGridRowBorderMarked`
  - `tableRowBackgroundMarked`
  - `tableRowBackgroundMarkedHover`
- Added `EuiFlyoutChild` and `EuiFlyoutSessionProvider`
([#8771](elastic/eui#8771))
- Added `setListOptionRefs` prop on `EuiComboBoxList`
([#8829](elastic/eui#8829))

**Breaking changes**

- Removed `iInCircle` icon (use `info` instead)
([#8841](elastic/eui#8841))
- Removed `questionInCircle` icon (use `question` instead)
([#8841](elastic/eui#8841))

**Accessibility**

- Improved the experience of `EuiProgress` by ensuring that determinate
updates are read out immediately to screen readers
([#8839](elastic/eui#8839))
- Fixed missing screen reader output for `EuiComboBox` with `options`
that have custom `id` attributes
([#8829](elastic/eui#8829))

### `@elastic/eui-theme-borealis`

####
[`v3.2.0`](https://github.com/elastic/eui/blob/main/packages/eui-theme-borealis/changelogs/CHANGELOG_2025.md#v320)

- Added component tokens:
([#8834](elastic/eui#8834))
  - `dataGridRowBackgroundMarked`
  - `dataGridRowBackgroundMarkedHover`
  - `dataGridRowBorderActive`
  - `dataGridRowBorderHover`
  - `dataGridRowBorderMarked`
  - `tableRowBackgroundMarked`
  - `tableRowBackgroundMarkedHover`

## Summary

- **Marked row styling** for `EuiDataGrid` and `EuiBasicTable`: new CSS
classes are available for consistent styling of marked rows (different
from selected), including hover and cell outline styles
(elastic/eui#8834)
- **New flyout component**: `EuiFlyoutChild` allows side-by-side
(grouped) flyout panels (elastic/eui#8771)
- **Accessibility fixes:**
- `EuiComboBox` now supports custom option `id`s
(elastic/eui#8829)
- Updates on `EuiProgress` are properly announced by screen readers
(elastic/eui#8839)
- **Icon updates** (breaking change): `iInCircle` and `questionInCircle`
icons have been renamed to `info` and `question` respectively
(elastic/eui#8841)

---------

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: Lene Gadewoll <[email protected]>
Bluefinger pushed a commit to Bluefinger/kibana that referenced this pull request Jul 22, 2025
`104.1.0` ⏩ `105.0.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

### `@elastic/eui`

#### [`v105.0.0`](https://github.com/elastic/eui/releases/v105.0.0)

- Added marked row styling via the classes `euiDataGridRow--marked` and
`euiTableRow--marked` for `EuiDataGrid` and `EuiBasicTable`
([elastic#8834](elastic/eui#8834))
- Added component tokens:
([elastic#8834](elastic/eui#8834))
  - `dataGridRowBackgroundMarked`
  - `dataGridRowBackgroundMarkedHover`
  - `dataGridRowBorderActive`
  - `dataGridRowBorderHover`
  - `dataGridRowBorderMarked`
  - `tableRowBackgroundMarked`
  - `tableRowBackgroundMarkedHover`
- Added `EuiFlyoutChild` and `EuiFlyoutSessionProvider`
([elastic#8771](elastic/eui#8771))
- Added `setListOptionRefs` prop on `EuiComboBoxList`
([elastic#8829](elastic/eui#8829))

**Breaking changes**

- Removed `iInCircle` icon (use `info` instead)
([elastic#8841](elastic/eui#8841))
- Removed `questionInCircle` icon (use `question` instead)
([elastic#8841](elastic/eui#8841))

**Accessibility**

- Improved the experience of `EuiProgress` by ensuring that determinate
updates are read out immediately to screen readers
([elastic#8839](elastic/eui#8839))
- Fixed missing screen reader output for `EuiComboBox` with `options`
that have custom `id` attributes
([elastic#8829](elastic/eui#8829))

### `@elastic/eui-theme-borealis`

####
[`v3.2.0`](https://github.com/elastic/eui/blob/main/packages/eui-theme-borealis/changelogs/CHANGELOG_2025.md#v320)

- Added component tokens:
([elastic#8834](elastic/eui#8834))
  - `dataGridRowBackgroundMarked`
  - `dataGridRowBackgroundMarkedHover`
  - `dataGridRowBorderActive`
  - `dataGridRowBorderHover`
  - `dataGridRowBorderMarked`
  - `tableRowBackgroundMarked`
  - `tableRowBackgroundMarkedHover`

## Summary

- **Marked row styling** for `EuiDataGrid` and `EuiBasicTable`: new CSS
classes are available for consistent styling of marked rows (different
from selected), including hover and cell outline styles
(elastic/eui#8834)
- **New flyout component**: `EuiFlyoutChild` allows side-by-side
(grouped) flyout panels (elastic/eui#8771)
- **Accessibility fixes:**
- `EuiComboBox` now supports custom option `id`s
(elastic/eui#8829)
- Updates on `EuiProgress` are properly announced by screen readers
(elastic/eui#8839)
- **Icon updates** (breaking change): `iInCircle` and `questionInCircle`
icons have been renamed to `info` and `question` respectively
(elastic/eui#8841)

---------

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: Lene Gadewoll <[email protected]>
kertal pushed a commit to kertal/kibana that referenced this pull request Jul 25, 2025
`104.1.0` ⏩ `105.0.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

### `@elastic/eui`

#### [`v105.0.0`](https://github.com/elastic/eui/releases/v105.0.0)

- Added marked row styling via the classes `euiDataGridRow--marked` and
`euiTableRow--marked` for `EuiDataGrid` and `EuiBasicTable`
([elastic#8834](elastic/eui#8834))
- Added component tokens:
([elastic#8834](elastic/eui#8834))
  - `dataGridRowBackgroundMarked`
  - `dataGridRowBackgroundMarkedHover`
  - `dataGridRowBorderActive`
  - `dataGridRowBorderHover`
  - `dataGridRowBorderMarked`
  - `tableRowBackgroundMarked`
  - `tableRowBackgroundMarkedHover`
- Added `EuiFlyoutChild` and `EuiFlyoutSessionProvider`
([elastic#8771](elastic/eui#8771))
- Added `setListOptionRefs` prop on `EuiComboBoxList`
([elastic#8829](elastic/eui#8829))

**Breaking changes**

- Removed `iInCircle` icon (use `info` instead)
([elastic#8841](elastic/eui#8841))
- Removed `questionInCircle` icon (use `question` instead)
([elastic#8841](elastic/eui#8841))

**Accessibility**

- Improved the experience of `EuiProgress` by ensuring that determinate
updates are read out immediately to screen readers
([elastic#8839](elastic/eui#8839))
- Fixed missing screen reader output for `EuiComboBox` with `options`
that have custom `id` attributes
([elastic#8829](elastic/eui#8829))

### `@elastic/eui-theme-borealis`

####
[`v3.2.0`](https://github.com/elastic/eui/blob/main/packages/eui-theme-borealis/changelogs/CHANGELOG_2025.md#v320)

- Added component tokens:
([elastic#8834](elastic/eui#8834))
  - `dataGridRowBackgroundMarked`
  - `dataGridRowBackgroundMarkedHover`
  - `dataGridRowBorderActive`
  - `dataGridRowBorderHover`
  - `dataGridRowBorderMarked`
  - `tableRowBackgroundMarked`
  - `tableRowBackgroundMarkedHover`

## Summary

- **Marked row styling** for `EuiDataGrid` and `EuiBasicTable`: new CSS
classes are available for consistent styling of marked rows (different
from selected), including hover and cell outline styles
(elastic/eui#8834)
- **New flyout component**: `EuiFlyoutChild` allows side-by-side
(grouped) flyout panels (elastic/eui#8771)
- **Accessibility fixes:**
- `EuiComboBox` now supports custom option `id`s
(elastic/eui#8829)
- Updates on `EuiProgress` are properly announced by screen readers
(elastic/eui#8839)
- **Icon updates** (breaking change): `iInCircle` and `questionInCircle`
icons have been renamed to `info` and `question` respectively
(elastic/eui#8841)

---------

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

6 participants