Split button

SplitButtonControl

One click for the usual action, the caret for its alternatives.

Overview

SplitButtonControl is a Blazor split button: a click on the main half runs the usual action, and the caret opens a list of its alternatives. Use it when one action is the default and the rest are variants, such as Send reply with Send a copy to me or Add as internal note: one button replaces several in a crowded toolbar, and unlike a dropdown button the main half acts at once. The main half raises OnClick; a picked item raises OnItemClick with its Value.

Examples

#Default action with alternatives

Click the left half to send the reply, or the caret for its alternatives; each enabled entry carries a Value the handler reads, and Reply by chat is disabled. Mark the ticket solved and the whole button is Disabled.

Open
Activity
  • Reply to Albus Door on TKT-1042 is ready

#Custom main half and colors

Three tickets are waiting on the customer. Remind everyone with one click or one customer from the menu: the count is your own markup in the main half, Title names both halves, the items are rebuilt as people drop off, and Style sets the --fx-split-btn-* colors.

Still to remind: Ron Measly, Luna Goodlove, Neville Longbutton

Documentation

ParameterTypeDefaultDescription
Textstring?nullLabel of the main half; wins over ChildContent, and names both halves when Title is not set.
IconCssstring?nullClasses for an icon before the main half's label, such as bi bi-envelope.
ChildContentRenderFragment?nullYour own markup for the main half, such as a count; used when Text is not set.
ItemsIList<SplitButtonItem>?nullThe menu entries, in order. A new list re-renders the menu, so it can follow page state.
MenuContentRenderFragment?nullYour own markup after the items, such as options to check; clicks inside it keep the menu open.
DisabledboolfalseDisables both halves and hides the menu; the button fades to 60% and ignores the pointer. A menu left open is only hidden: it shows again when the control is enabled.
Title (base)string?nullTooltip and accessible name of the main half; the caret gets the same text plus " options". Falls back to Text; with neither, the caret is named "More options".
Enabled (base)booltrueNot read. Use Disabled; Enabled="false" leaves both halves active.
Visible (base)booltrueNot read. Visible="false" does not hide the control.
Id (base)string?nullNever rendered. An id attribute binds to this parameter, so it does not reach the host either.
CssClass / Style (base)string?nullAppended to, and inline style on, the host element.
Tag / Data / Parent (base)nullAccepted but not rendered.
(unmatched attributes)Dictionary<string,object>—Forwarded to the host <div>, not to the buttons.
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.