Split button

SplitButtonControl

A default action, with its alternatives behind the caret.

Overview

SplitButtonControl renders two native buttons side by side. The main half fires OnClick; the caret half opens a menu built from Items, followed by any markup in MenuContent. A click-away backdrop closes the menu; no JavaScript. Use it when one action is the default and the others are variants of it. When there is no default action, use ButtonControl's dropdown mode.

Examples

#Default action with alternatives

Text and IconCss label the main half. A disabled item renders but does not fire. Disabled greys out both halves.

Example
Razor
C#

Documentation

Parameters

ParameterTypeDefaultDescription
Textstring?nullLabel of the main half. Wins over ChildContent when set.
IconCssstring?nullLeading icon on the main half.
ChildContentRenderFragment?—Main-half markup, used when Text is not set.
ItemsIList<SplitButtonItem>?nullMenu entries, in order.
MenuContentRenderFragment?nullExtra markup rendered after the items inside the menu.
DisabledboolfalseDisables both halves; the host fades and ignores pointer events.
OnClickEventCallback—Main half clicked. No arguments.
OnItemClickEventCallback<SplitButtonItem>—Menu entry picked. The menu closes first.
CssClass / Stylestring?nullAppended to, and inline style on, the host element.
(unmatched attributes)Dictionary<string,object>—Forwarded to the host <div>, not to the buttons.

SplitButtonItem

PropertyTypeDefaultDescription
Textstring""Entry label.
IconCssstring?nullLeading icon.
Valueobject?nullAny payload; read it in OnItemClick instead of matching on Text.
DisabledboolfalseRendered greyed; clicks ignored.
ctor—new(text, iconCss, value, disabled), all but text optional.

Colors are fixed in the control's stylesheet; it reads no --fx-* variables. Restyle by overriding these classes.

CSS classes

ClassEffect
fx-split-button-hostInline-flex wrapper; the menu is positioned against it. Gets fx-split-button-disabled when disabled.
fx-split-button-main · fx-split-button-toggleThe two halves. Blue fill, shared border, rounded outer corners.
fx-split-button-dropdownThe menu: white panel under the control, right-aligned, 150px minimum.
fx-split-button-itemOne entry; .disabled halves its opacity.
fx-split-button-backdropFull-screen transparent layer that closes the menu on click.

Keyboard and accessibility

  • Both halves are native <button>s: Tab reaches each, Space and Enter activate.
  • The caret half sets aria-haspopup and aria-expanded.
  • Menu entries are native buttons: Tab moves through them, Enter or Space picks. There is no arrow-key or Escape handling; a pick or click-away closes the menu.
  • Disabled sets the native disabled attribute on both halves and ignores pointer events on the host.
An unhandled error has occurred. Reload 🗙

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.