Skip to content

feat(react-headless-components-preview): add headless Overflow#36305

Open
mainframev wants to merge 4 commits into
microsoft:masterfrom
mainframev:feat/headless-overflow
Open

feat(react-headless-components-preview): add headless Overflow#36305
mainframev wants to merge 4 commits into
microsoft:masterfrom
mainframev:feat/headless-overflow

Conversation

@mainframev

@mainframev mainframev commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Previous Behavior

@fluentui/react-headless-components-preview had no overflow primitive, so teams building custom design systems had no unstyled Overflow.

New Behavior

Adds a headless Overflow with a new ./overflow entrypoint. It reuses the building blocks exposed by @fluentui/react-overflow (see #36304):

  • Overflow — thin root that provides the overflow context; uses useOverflow_unstable + renderOverflow_unstable and intentionally skips the styles hook.
  • useOverflow / renderOverflow / useOverflowContextValues — direct re-exports of the _unstable hooks from @fluentui/react-overflow.
  • useOverflowMenu, OverflowItem, OverflowDivider, OverflowReorderObserver and the consumer hooks (useOverflowCount, useIsOverflowItemVisible, useIsOverflowGroupVisible, useOverflowVisibility, useOverflowContext) plus the DATA_* constants are re-exported as-is.

Consistent with the package's data-attribute convention, the overflow engine sets data-overflowing / data-overflow-menu and the consumer styles them — the package ships no CSS. The two layout rules the engine relies on are documented in the story and component description:

[data-overflowing] {
  display: none;
} /* removes overflowed items from layout */
[data-overflow-menu] {
  flex-shrink: 0;
} /* keeps the overflow menu at full size for measurement */

Note

Depends on #36304

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-headless-components-preview
react-headless-components-preview: entire library
236.96 kB
67.865 kB
248.42 kB
71.443 kB
11.46 kB
3.578 kB

🤖 This report was generated against a90442996224b76904a73761ad77f9b1f68239a3

@github-actions

Copy link
Copy Markdown

Pull request demo site: URL

@@ -0,0 +1,7 @@
{

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🕵🏾‍♀️ visual changes to review in the Visual Change Report

vr-tests-react-components/Avatar Converged 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Avatar Converged.badgeMask - RTL.normal.chromium.png 3 Changed
vr-tests-react-components/Charts-DonutChart 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Charts-DonutChart.Dynamic - RTL.default.chromium.png 2375 Changed
vr-tests-react-components/Menu Converged - submenuIndicator slotted content 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Menu Converged - submenuIndicator slotted content.default.submenus open.chromium.png 413 Changed
vr-tests-react-components/Positioning 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Positioning.Positioning end.chromium.png 883 Changed
vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png 861 Changed
vr-tests-react-components/ProgressBar converged 3 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/ProgressBar converged.Indeterminate + thickness - Dark Mode.default.chromium.png 48 Changed
vr-tests-react-components/ProgressBar converged.Indeterminate + thickness.default.chromium.png 187 Changed
vr-tests-react-components/ProgressBar converged.Indeterminate + thickness - High Contrast.default.chromium.png 171 Changed
vr-tests-react-components/TagPicker 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/TagPicker.disabled - Dark Mode.chromium.png 658 Changed

There were 3 duplicate changes discarded. Check the build logs for more information.

@mainframev mainframev force-pushed the feat/headless-overflow branch from 5658487 to 8270b2b Compare June 15, 2026 15:26
@mainframev mainframev marked this pull request as ready for review June 15, 2026 15:26
@mainframev mainframev requested a review from a team as a code owner June 15, 2026 15:26
beforeAll(() => {
// jsdom does not implement ResizeObserver, which the overflow manager observes the container with.
// https://github.com/jsdom/jsdom/issues/3368
global.ResizeObserver = class ResizeObserver {

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.

/**
* Overflow Props
*/
export type OverflowProps = OverflowBaseProps;

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.

lets re-export from @fluentui/react-overflow

import * as React from 'react';
import { Overflow, OverflowItem } from '@fluentui/react-headless-components-preview/overflow';

import { OverflowMenu } from './OverflowMenu';

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.

this might not work in export to sandbox scenario, can you please double check?

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.

right, ty!


return (
<>
<button

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.

consider using headless menu component

* reference implementation.
*/
const MenuGroupDivider: React.FC<{ groupId: number }> = ({ groupId }) => {
const groupVisibilities = Object.values(GROUPS).map(group => ({

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.

do we have such complexity in v9 examples as well? can we simplify it somehow?

const groupVisibilities = Object.values(GROUPS).map(group => ({
group,
// eslint-disable-next-line react-hooks/rules-of-hooks
visibility: useIsOverflowGroupVisible(group.toString()),

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.

we'll also need to fix this

@dmytrokirpa

Copy link
Copy Markdown
Contributor

@mainframev could you please also add Overflow components to bundle size report

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 a new headless Overflow primitive to @fluentui/react-headless-components-preview via a dedicated ./overflow entrypoint, primarily by re-exporting the engine/hooks from @fluentui/react-overflow and providing a thin, unstyled Overflow root plus Storybook documentation/examples.

Changes:

  • Add ./overflow entrypoint exporting Overflow plus relevant hooks/components/constants, backed by @fluentui/react-overflow.
  • Add Storybook stories + docs + CSS module demonstrating usage patterns (default, vertical, reverse order, pinned, dividers, priority).
  • Add unit tests + API report + Beachball change file, and update package exports/deps.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
packages/react-components/react-headless-components-preview/stories/src/Overflow/OverflowVertical.stories.tsx Adds vertical overflow story example.
packages/react-components/react-headless-components-preview/stories/src/Overflow/OverflowReverseDomOrder.stories.tsx Adds reverse DOM overflow direction story example.
packages/react-components/react-headless-components-preview/stories/src/Overflow/OverflowPriorityWithDividers.stories.tsx Adds priority + divider handling example (advanced scenario).
packages/react-components/react-headless-components-preview/stories/src/Overflow/OverflowPinned.stories.tsx Adds pinned-items example story.
packages/react-components/react-headless-components-preview/stories/src/Overflow/OverflowMenu.tsx Adds shared overflow menu example built from headless hooks.
packages/react-components/react-headless-components-preview/stories/src/Overflow/OverflowLargerDividers.stories.tsx Adds OverflowDivider usage example story.
packages/react-components/react-headless-components-preview/stories/src/Overflow/OverflowDescription.md Documents required data-attribute CSS rules + composition guidance.
packages/react-components/react-headless-components-preview/stories/src/Overflow/OverflowDefault.stories.tsx Adds default overflow story example.
packages/react-components/react-headless-components-preview/stories/src/Overflow/overflow.module.css Provides demo styling + required data-attribute layout rules for stories.
packages/react-components/react-headless-components-preview/stories/src/Overflow/index.stories.tsx Registers the Overflow stories and docs description.
packages/react-components/react-headless-components-preview/library/src/overflow.ts Creates the public overflow entrypoint exports/types.
packages/react-components/react-headless-components-preview/library/src/components/Overflow/useOverflowContextValues.ts Re-exports useOverflowContextValues_unstable under headless entrypoint.
packages/react-components/react-headless-components-preview/library/src/components/Overflow/useOverflow.ts Re-exports useOverflow_unstable under headless entrypoint.
packages/react-components/react-headless-components-preview/library/src/components/Overflow/renderOverflow.ts Re-exports renderOverflow_unstable under headless entrypoint.
packages/react-components/react-headless-components-preview/library/src/components/Overflow/Overflow.types.ts Defines exported headless Overflow types (largely aliases to react-overflow).
packages/react-components/react-headless-components-preview/library/src/components/Overflow/Overflow.tsx Adds thin headless Overflow root (use + context-values + render; no styles hook).
packages/react-components/react-headless-components-preview/library/src/components/Overflow/Overflow.test.tsx Adds conformance + behavioral unit tests for headless Overflow.
packages/react-components/react-headless-components-preview/library/src/components/Overflow/index.ts Exposes Overflow + re-exports advanced hooks/components/constants from react-overflow.
packages/react-components/react-headless-components-preview/library/package.json Adds dependency on @fluentui/react-overflow and export map entry for ./overflow.
packages/react-components/react-headless-components-preview/library/etc/overflow.api.md Adds API Extractor report for the new entrypoint.
change/@fluentui-react-headless-components-preview-4bdc7f70-88bc-4b7a-8c35-7ddd600b9a3c.json Adds Beachball change file for publishing the new entrypoint.

@mainframev mainframev force-pushed the feat/headless-overflow branch from 98b8f52 to 747370f Compare June 16, 2026 13:19
@mainframev mainframev requested a review from dmytrokirpa June 16, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants