Skip to content

Conversation

fogelek
Copy link
Contributor

@fogelek fogelek commented Jun 4, 2025

This PR adds the SplitButton component to the Teams component library:

  • Simplified usage (No need to wrap split button with MenuTrigger)
  • Built-in tooltip
  • Extended functionality to allow separate tooltips between primary button and menu button

SplitButtonPropsBase,
'size' | 'disabled' | 'disabledFocusable'
> {
appearance?: 'transparent' | 'primary';
Copy link
Member

Choose a reason for hiding this comment

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

You could extend from ButtonProps

* SplitButtons are a grouping of two interactive surfaces where interacting with the first one triggers a primary
* action, while interacting with the second one opens a menu with secondary actions.
*/
export const SplitButton = React.forwardRef<
Copy link
Member

Choose a reason for hiding this comment

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

SplitButton in Fluent is a bit of a weird component since it really doesn't like JSX children. Wondering if we want to consider an children based API for the teams version of this

<SplitButton>
  <SplitButtonMain />
  <SplitButtonMenu />
</SplitButton>

@fogelek fogelek marked this pull request as ready for review July 3, 2025 08:40
@fogelek fogelek requested review from a team as code owners July 3, 2025 08:40
return (
<div className={styles.sampleContainer}>
<Menu positioning="below-end">
<SplitButton>Split</SplitButton>
Copy link
Member

Choose a reason for hiding this comment

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

Is it accessible to create a split button without a title/aria-label for the menu button part?


it('should throw error if menuTitle is provided without main title', () => {
expect(() =>
render(<SplitButton menuTitle="Menu">Test</SplitButton>)
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand this requirement, why would menu title make the title required?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If title is provided without menu title, tooltip will be applied to the full SplitButton
If both are given, there will be separate tooltip for action button and menu button - so I think it makes no sense to be able to provide only menu title

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.

2 participants