Skip to content

feat(react-headless-components-preview): add headless MenuButton#36320

Open
mainframev wants to merge 1 commit into
microsoft:masterfrom
mainframev:feat/headless-menu-button
Open

feat(react-headless-components-preview): add headless MenuButton#36320
mainframev wants to merge 1 commit into
microsoft:masterfrom
mainframev:feat/headless-menu-button

Conversation

@mainframev

@mainframev mainframev commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a headless, unstyled MenuButton to @fluentui/react-headless-components-preview, following the same pattern as the existing headless Button and ToggleButton: it consumes useMenuButtonBase_unstable from @fluentui/react-button and adds data-* styling-hook attributes, re-exporting the shared renderMenuButton_unstable.

⚠️ Stacked on #36319 (the react-button base hook). This PR is a Draft until #36319 merges. Until then its diff also shows the react-button changes from #36319 — once that lands I'll rebase this branch onto master, leaving only the headless additions below.

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown

📊 Bundle size report

✅ No changes found

@github-actions

Copy link
Copy Markdown

Pull request demo site: URL

@mainframev mainframev self-assigned this Jun 17, 2026
@mainframev mainframev force-pushed the feat/headless-menu-button branch 5 times, most recently from 30449c8 to 7a064fa Compare June 17, 2026 21:16
Comment thread change/@fluentui-react-button-3e45fb7a-a8fa-4902-a694-fa9b89a68fd1.json Outdated
@mainframev mainframev marked this pull request as ready for review June 18, 2026 11:55
@mainframev mainframev requested a review from a team as a code owner June 18, 2026 11:55

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, unstyled MenuButton surface to @fluentui/react-headless-components-preview, built on top of a new useMenuButtonBase_unstable base hook in @fluentui/react-button (this PR is currently stacked on #36319 per the description).

Changes:

  • Add headless MenuButton implementation, exports, stories, and API report for @fluentui/react-headless-components-preview/menu-button.
  • Add useMenuButtonBase_unstable + base types in @fluentui/react-button, and widen renderMenuButton_unstable to accept MenuButtonBaseState.
  • Add tests and beachball change files for both packages.

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/react-components/react-headless-components-preview/stories/src/MenuButton/MenuButtonWithIcon.stories.tsx Adds icon + icon-only story variants for headless MenuButton.
packages/react-components/react-headless-components-preview/stories/src/MenuButton/MenuButtonSize.stories.tsx Adds size styling examples for headless MenuButton.
packages/react-components/react-headless-components-preview/stories/src/MenuButton/MenuButtonDisabled.stories.tsx Adds disabled/disabledFocusable examples for headless MenuButton.
packages/react-components/react-headless-components-preview/stories/src/MenuButton/MenuButtonDescription.md Adds docs description for the new headless MenuButton stories page.
packages/react-components/react-headless-components-preview/stories/src/MenuButton/MenuButtonDefault.stories.tsx Adds default usage story (as Menu trigger).
packages/react-components/react-headless-components-preview/stories/src/MenuButton/MenuButtonAppearance.stories.tsx Adds appearance styling examples (primary/secondary/subtle/outline) via CSS classes.
packages/react-components/react-headless-components-preview/stories/src/MenuButton/menu-button.module.css Adds story-only styling using CSS variables and data-* hooks.
packages/react-components/react-headless-components-preview/stories/src/MenuButton/index.stories.tsx Registers MenuButton stories under Components/MenuButton.
packages/react-components/react-headless-components-preview/library/src/menu-button.ts Adds the package entrypoint re-export for menu-button subpath.
packages/react-components/react-headless-components-preview/library/src/components/MenuButton/useMenuButton.ts Implements headless useMenuButton wrapper to add data-* styling hooks.
packages/react-components/react-headless-components-preview/library/src/components/MenuButton/renderMenuButton.ts Re-exports shared renderMenuButton_unstable from @fluentui/react-button.
packages/react-components/react-headless-components-preview/library/src/components/MenuButton/MenuButton.types.ts Defines headless MenuButtonState augmentation and re-exports props/slots.
packages/react-components/react-headless-components-preview/library/src/components/MenuButton/MenuButton.tsx Adds headless MenuButton component wrapper (ForwardRefComponent).
packages/react-components/react-headless-components-preview/library/src/components/MenuButton/MenuButton.test.tsx Adds headless component conformance + basic rendering/state tests.
packages/react-components/react-headless-components-preview/library/src/components/MenuButton/index.ts Adds component-level barrel exports for headless MenuButton.
packages/react-components/react-headless-components-preview/library/package.json Adds "./menu-button" export map entry.
packages/react-components/react-headless-components-preview/library/etc/menu-button.api.md Adds API Extractor report output for the new headless menu-button entrypoint.
packages/react-components/react-button/library/src/MenuButton.ts Re-exports new base hook + base types for public consumption.
packages/react-components/react-button/library/src/index.ts Adds new base hook + base types exports at package root.
packages/react-components/react-button/library/src/components/MenuButton/useMenuButtonBase.test.tsx Adds unit tests for useMenuButtonBase_unstable.
packages/react-components/react-button/library/src/components/MenuButton/useMenuButton.tsx Implements useMenuButtonBase_unstable and refactors useMenuButton_unstable to build on it.
packages/react-components/react-button/library/src/components/MenuButton/renderMenuButton.tsx Widens render signature from styled state to base state.
packages/react-components/react-button/library/src/components/MenuButton/MenuButton.types.ts Adds MenuButtonBaseProps/MenuButtonBaseState for headless composition.
packages/react-components/react-button/library/src/components/MenuButton/index.ts Exports new base hook + base types from component barrel.
packages/react-components/react-button/library/etc/react-button.api.md Updates public API report for new base hook/types and widened render signature.
change/@fluentui-react-headless-components-preview-7246c651-b258-4694-b0e7-45b666b15aae.json Adds beachball change entry for headless MenuButton.
change/@fluentui-react-button-3e45fb7a-a8fa-4902-a694-fa9b89a68fd1.json Adds beachball change entry for new useMenuButtonBase_unstable.

@mainframev mainframev force-pushed the feat/headless-menu-button branch from 43c60bc to bbae420 Compare June 19, 2026 13:28
expect(button).toBeInTheDocument();
expect(button).toHaveAttribute('type', 'button');
expect(button).toHaveAttribute('aria-expanded', 'false');
expect(button.querySelector('svg')).toBeInTheDocument();

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.

where the svg comes from? we shouldn't have default icons implementation in headless


export { Default } from './MenuButtonDefault.stories';
export { Appearance } from './MenuButtonAppearance.stories';
export { Size } from './MenuButtonSize.stories';

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 leave only default story and add a link to Menu component stories that uses MenuButton instead of the regular Button component, wdyt?

also appearance/size stories don't have much sense for headless

@mainframev mainframev force-pushed the feat/headless-menu-button branch 2 times, most recently from 095e38d to 2f632b1 Compare June 22, 2026 15:05
@mainframev mainframev force-pushed the feat/headless-menu-button branch from 2f632b1 to 97f87e3 Compare June 22, 2026 15:07
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