Skip to content

feat(react-headless-components-preview): add headless SplitButton - #36525

Open
mainframev wants to merge 2 commits into
feat/split-button-base-hookfrom
feat/split-button-headless
Open

feat(react-headless-components-preview): add headless SplitButton#36525
mainframev wants to merge 2 commits into
feat/split-button-base-hookfrom
feat/split-button-headless

Conversation

@mainframev

@mainframev mainframev commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

PR 3 of a 3-PR stack. Base: #36524.

Adds a stable, unstyled SplitButton primitive to @fluentui/react-headless-components-preview, composing the useSplitButtonBase_unstable base hook introduced in #36524 with the existing headless Button and MenuButton primitives.

Stack:

  1. test(react-button): add SplitButton regression test before base-hook extraction #36523 — regression tests
  2. feat(react-button): expose useSplitButtonBase_unstable base hook #36524@fluentui/react-button base-hook extraction
  3. this PR — headless SplitButton

What changed

  • New library/src/components/SplitButton/: SplitButton.tsx, useSplitButton.ts, renderSplitButton.tsx, SplitButton.types.ts, index.ts.
    • SplitButtonProps/SplitButtonSlots/SplitButtonState are aliased directly from the base types exported by @fluentui/react-button (no appearance/size/shape).
    • useSplitButton composes useSplitButtonBase_unstable and recreates both child slots with the headless Button/MenuButton via slot.optional (not by patching state.components), so the headless MenuButton supplies no default menu icon — consumers provide their own via the menuIcon slot.
    • The wrapper adds no SplitButton-specific data-* attributes; the nested headless Button/MenuButton remain the sole owners of data-disabled, data-disabled-focusable, and data-icon-only.
  • New top-level barrel library/src/split-button.ts.
  • library/package.json: added the ./split-button export map entry (alphabetized).
  • library/bundle-size/AllComponents.fixture.js: added the SplitButton import/reference (alphabetized).
  • New SplitButton.test.tsx (22 tests): isConformant, default render, ref forwarding, no default menu icon, custom menuIcon, aria-labelledby fallback, disabled/disabledFocusable propagation to children (not the wrapper), per-slot overrides, and resolved child slot metadata pointing at the headless Button/MenuButton.
  • New Storybook story (stories/src/SplitButton/) composing the real headless Menu/MenuTrigger/MenuPopover/MenuList/MenuItem family via MenuTrigger's render-prop pattern, styled with CSS Modules and the stories' token variables only. Manually verified in a built Storybook: primary action fires independently, menu opens/closes (aria-expanded, Escape), and both interactions are independent.
  • Regenerated split-button.api.md.
Screenshot 2026-08-05 at 23 15 30 Screenshot 2026-08-05 at 23 15 32

@mainframev
mainframev requested a review from a team as a code owner August 5, 2026 19:37
@mainframev
mainframev marked this pull request as draft August 5, 2026 19:38
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Pull request demo site: URL

@mainframev
mainframev force-pushed the feat/split-button-headless branch 2 times, most recently from 5e4080e to 1729fa7 Compare August 5, 2026 20:17
@mainframev
mainframev force-pushed the feat/split-button-headless branch 2 times, most recently from df877af to 62beaec Compare August 5, 2026 20:32
@mainframev mainframev self-assigned this Aug 5, 2026
@mainframev
mainframev force-pushed the feat/split-button-headless branch 3 times, most recently from 94e9f32 to 43f0c90 Compare August 5, 2026 21:29
@mainframev
mainframev force-pushed the feat/split-button-headless branch from 43f0c90 to 314810d Compare August 5, 2026 21:32
@mainframev
mainframev force-pushed the feat/split-button-headless branch from 314810d to bc760d3 Compare August 5, 2026 21:50
@mainframev
mainframev marked this pull request as ready for review August 5, 2026 21:54
Composes the design-agnostic useSplitButtonBase_unstable from
@fluentui/react-button with the existing headless Button and MenuButton
primitives to expose a stable, unstyled SplitButton.

- SplitButton, useSplitButton, renderSplitButton, and the SplitButtonProps/
  SplitButtonSlots/SplitButtonState types are re-exported/aliased from the
  base API introduced in @fluentui/react-button (no appearance/size/shape).
- The wrapper adds no SplitButton-specific data-* attributes; the nested
  headless Button and MenuButton remain the state owners.
- Adds the ./split-button package export, bundle-size fixture entry, API
  report, unit tests, and a Storybook story composing the real headless Menu
  family via MenuTrigger's render-prop pattern.
…unstable from @fluentui/react-button

Mirrors the existing Button/MenuButton pattern
(export { renderX_unstable as renderX } from '@fluentui/react-button')
instead of duplicating the render body now that renderSplitButton_unstable
accepts SplitButtonBaseState.
@mainframev
mainframev force-pushed the feat/split-button-headless branch from bc760d3 to a9bc5b3 Compare August 5, 2026 21:56
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.

1 participant