Skip to content

[Workspace Chrome] Bootstrap new grid layout components#223890

Merged
Dosant merged 18 commits intoelastic:mainfrom
Dosant:d/2025-06-13-application-layout
Jun 19, 2025
Merged

[Workspace Chrome] Bootstrap new grid layout components#223890
Dosant merged 18 commits intoelastic:mainfrom
Dosant:d/2025-06-13-application-layout

Conversation

@Dosant
Copy link
Copy Markdown
Contributor

@Dosant Dosant commented Jun 13, 2025

This is largely based of @clintandrewhall's work that he extracted from the new workspace layout poc. These components are a decent starting point for new grid layout and I validated that the layout mostly works for Kibana (fixing a couple of edge cases)

I believe the components are ready to be merged into the main branch to make future reviews easier:

Bootstraps a new @kbn/core-chrome-layout-components package to provide composable React primitives for Kibana’s Chrome layout, including region components, a debug overlay, Storybook stories, and initial docs.

  • Adds layout region components (Banner, Header, Navigation, Sidebar, Panels, Application, Footer) and a debug overlay with Emotion styling.
  • Provides a README with usage examples (Storybook-driven) and API documentation.

yarn storybook sharedux

Screenshot 2025-06-13 at 12 57 48

@Dosant Dosant changed the title D/2025 06 13 application layout [Workspace Chrome] Bootstrap new grid layout components Jun 13, 2025
@Dosant Dosant requested a review from Copilot June 16, 2025 09:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Bootstraps a new @kbn/core-chrome-layout-components package to provide composable React primitives for Kibana’s Chrome layout, including region components, a debug overlay, Storybook stories, and initial docs.

  • Adds layout region components (Banner, Header, Navigation, Sidebar, Panels, Application, Footer) and a debug overlay with Emotion styling.
  • Sets up Jest and Storybook configuration, introduces a Box utility, and updates package.json and CODEOWNERS.
  • Provides a README with usage examples (Storybook-driven) and API documentation.

Reviewed Changes

Copilot reviewed 44 out of 44 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/core/packages/chrome/layout/core-chrome-layout-components/jest.config.js Jest config for the new layout package
src/core/packages/chrome/layout/core-chrome-layout-components/index.ts Exports core components and config provider
src/core/packages/chrome/layout/core-chrome-layout-components/header/* Header region component and styles
src/core/packages/chrome/layout/core-chrome-layout-components/footer/* Footer region component and styles
src/core/packages/chrome/layout/core-chrome-layout-components/banner/* Banner region component and styles
src/core/packages/chrome/layout/core-chrome-layout-components/application/* Application region component, overflow handling
src/core/packages/chrome/layout/core-chrome-layout-components/debug/* LayoutDebugOverlay for visualizing grid slots
src/core/packages/chrome/layout/core-chrome-layout-components/stories/* Storybook stories for layout and Box examples
src/core/packages/chrome/layout/core-chrome-layout-components/README.md Documentation and usage examples
package.json Registers the new layout package
.github/CODEOWNERS Adds ownership for the new package
Comments suppressed due to low confidence (7)

src/core/packages/chrome/layout/core-chrome-layout-components/README.md:55

  • The snippet uses <ChromeLayoutComponent> but the actual component name is ChromeLayout. Update this to <ChromeLayout> for accuracy.
    <ChromeLayoutComponent

src/core/packages/chrome/layout/core-chrome-layout-components/README.md:41

  • The README references LayoutConfigProvider, but the package exports ChromeLayoutConfigProvider. Update the import and usage to match the actual export.
  LayoutConfigProvider,

src/core/packages/chrome/layout/core-chrome-layout-components/banner/index.ts:10

  • The public API exports LayoutBanner but does not export its LayoutBannerProps type. Consider adding type LayoutBannerProps to maintain consistency with other components.
export { LayoutBanner } from './layout_banner';

src/core/packages/chrome/layout/core-chrome-layout-components/footer/index.ts:10

  • The API surface exports LayoutFooter but omits the LayoutFooterProps type. For consistency, export type LayoutFooterProps as well.
export { LayoutFooter } from './layout_footer';

src/core/packages/chrome/layout/core-chrome-layout-components/jest.config.js:14

  • Jest is configured for this package, but there are no test files present yet. Consider adding basic unit or snapshot tests for the new components to ensure they behave as expected.
};

src/core/packages/chrome/layout/core-chrome-layout-components/application/layout_application.styles.ts:15

  • The CSS grid-area is set to "app" but other slot names and variables use "application". This mismatch will break layout alignment—rename to grid-area: application; to match the rest of the system.
    grid-area: app;

src/core/packages/chrome/layout/core-chrome-layout-components/application/layout_application.styles.ts:11

  • The import path '../types' does not exist in this package. You need to add or correct the types.ts file so that EmotionFn can be resolved, otherwise this will cause a build error.
import { EmotionFn } from '../types';

@Dosant Dosant added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Team:SharedUX Platform AppEx-SharedUX (formerly Global Experience) t// labels Jun 16, 2025
@Dosant Dosant marked this pull request as ready for review June 16, 2025 12:33
@Dosant Dosant requested review from a team as code owners June 16, 2025 12:33
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/appex-sharedux (Team:SharedUX)

@Dosant Dosant requested a review from clintandrewhall June 16, 2025 12:34
Copy link
Copy Markdown
Contributor

@clintandrewhall clintandrewhall left a comment

Choose a reason for hiding this comment

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

Awesome work. Please address my comments before shipping. Thank you for tackling this!


import { styles } from './layout_application.styles';

export const LayoutApplication = ({ children }: { children: ReactNode }) => {
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.

nit: let's be sure these have docblocks

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.

I added them, but I'm not sure they are helpful, especially since most of these are private components.

grid-area: banner;
overflow: hidden;
position: sticky;
width: var(--kbn-layout--banner-width);
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.

So we decided to leverage the CSS variables, which is fine... but we should be sure to document this fact in the README and/or the global style component.

import React from 'react';

export interface LayoutStyleArgs {
bannerHeight: number;
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.

Suggested change
bannerHeight: number;
/** The height of the top-most banner */
bannerHeight: number;

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.

I am adding the comments, but I am not sure how valuable they are? aren't they just repeat what the prop name or component name says? e.g. bannerHeight === /** The height of the top-most banner */

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 think you have to address the public API exports called out by CI. Props tend to be publicly exposed from packages, and it's always nice to have them documented, (even if they feel redundant).


export type Slot = React.ReactNode | ((props: SlotProps) => React.ReactNode);

export interface ChromeLayoutSlots {
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.

nit: are all of these, indeed, optional?

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.

my current thinking, they are. there is "isChromeVisible" state when we hide everything except application. I am thinking now I'd do it by hiding everything using these props

const sidebar = css`
--kbn-layout--sidebar-top: ${bannerHeight}px;
--kbn-layout--sidebar-height: calc(100vh - var(--kbn-layout--sidebar-top));
--kbn-layout--sidebar-width: ${sidebarWidth}px;
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.

My only concern with putting this here, and not in the style property of the actual component, is a potential thrash if the sidebar is resized with a drag. Having this update with a debounce for consumers to alleviate performance issues would only be available if the node were sized with the raw value.

I'm ok shipping it this way, but at some point we might need to explore the performance implications, if any.

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.

I see... another problem will be animation - (open/closing a panel). will likely have to also change something around these variables

@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Jun 18, 2025

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/core-chrome-layout-components - 4 +4

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
@kbn/core 884 886 +2
Unknown metric groups

API count

id before after diff
@kbn/core-chrome-layout-components - 9 +9

History

@Dosant Dosant merged commit ada7278 into elastic:main Jun 19, 2025
12 checks passed
Dosant added a commit that referenced this pull request Jun 30, 2025
…and `content` area (#225824)

## Summary

Based on the
[discussion](https://elastic.slack.com/archives/C08GKQQ85U4/p1751027960744299)
this PR slightly reworks the layout introduced in
#223890.

For the Application Menu Bar, we need a header that is technically part
of the application grid cell. This PR introduces `applicationTopBar`
(and `applicationBottomBar` for consistency). It also adds a new set of
variables:
`--kbn-application--content-[top|bottom|left|right|height|width]`, which
will represent the "safe" application content space for applications to
use.
- `applicationBottomBar` now works like the previous `footer`, but it is
implemented differently—it is part of the application cell instead of
being its own grid cell.
- I kept the global `footer` just in case we need it and to properly
debug/test that the variables work correctly. I adjusted it to take up
the full width, similar to the banner.

## Before

![Screenshot 2025-06-30 at 14 05
38](https://github.com/user-attachments/assets/00684707-e619-4936-8ca5-1746dea8ae89)

## After

![Screenshot 2025-06-30 at 13 59
36](https://github.com/user-attachments/assets/af5e9056-4600-4c4b-adfb-93f1ae05d219)
@Dosant Dosant added the chrome-grid Work related to Chrome refactor to grid layout label Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting chrome-grid Work related to Chrome refactor to grid layout release_note:skip Skip the PR/issue when compiling release notes Team:SharedUX Platform AppEx-SharedUX (formerly Global Experience) t// v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants