Axon 911 Frontend DocsAxon 911 Frontend Docs
Axon 911 Frontend Docs
    Loading navigation…
U
User
Switch to light mode
  1. Components
  2. Split Button
  3. API and Development

Split button

API and Development

View SourceOpens in a new tabSubmit IssueOpens in a new tab
SplitButton renders a Button for the main label (children) and a Menu triggered by a chevron Interactable. Pass sibling menu content with the menuContent prop using SplitButtonItem, SplitButtonSeparator, SplitButtonLabel, and grouped variants (SplitButtonCheckbox, SplitButtonRadio, SplitButtonSwitch) as needed. Optional menuOpen / onMenuOpenChange control the menu; menuSide and menuAlign position the popover.
Props
NameTypeDefaultDescription
childrenReactNode—Menu rows: MenuItem, MenuCheckboxItem, MenuRadioGroup, MenuGroup, MenuSeparator and MenuSub. Mark a destructive row with destructive on MenuItem.
labelLocalizedMessage—Label of the primary action. When it changes the old label fades and blurs out and the new one fades in, and the button's width springs between the two widths. In the action shape this is the label at rest.
menuLabelLocalizedMessage—Accessible name of the chevron trigger, such as "More save options". Never drawn.
activeboolean—Non-toggle pressed or transient current marker; hosts write the pressed state key through stateAttributes (data-pressed). A toggle host (Button toggle variant) uses aria-pressed and styles with [aria-pressed="true"] without also writing data-pressed for that toggle state (ADR 0001 rule 1). Link "current" within a set uses aria-current, not active.
aria-currentboolean | "time" | "false" | "true" | "page" | "step" | "location" | "date"—Whether this item is current within a set.
aria-describedbystring—Id of the element that describes this control.
aria-descriptionLocalizedMessage—Accessible description when it cannot be referenced by id.
aria-labelLocalizedMessage—Accessible name when the visible label is insufficient.
aria-labelledbystring—Id of the element that names this control.
defaultMenuOpenbooleanfalseInitial open state of the menu when uncontrolled.
disabledboolean—Inert state per host: native disabled on a button; on Link, ADR 0006 link host (no href, aria-disabled="true", tabIndex={0}). Never tabIndex={-1}.
groupLabelLocalizedMessage—Accessible name of the pair, which is a role="group". Defaults to the primary button's own name, so the group is named by the action it wraps.
idstring—Element id for ARIA relationships.
intentButtonIntent—Visual intent. Defaults to {@link ButtonIntent.Neutral}.
leadingReactNode—Content before the label.
menuAlignAlign"end"Alignment of the menu along that edge, against the whole pair.
menuOpenboolean—Controlled open state of the menu. Pair with onMenuOpenChange.
menuSideSide"block-end"Preferred edge of the pair the menu opens against. Flips to the opposite edge when there is no room.
onAction(() => unknown)—Runs on click while the button is idle or showing success. The button is pending until the returned promise settles: a resolved promise shows the success state, a rejected one (or a synchronous throw) returns to idle and calls {@link ActionButtonOwnProps.onActionError}. A synchronous return counts as resolved. Needs the action shape. @returns A promise to wait for, or nothing
onActionError((error: unknown) => void)—Called with whatever onAction rejected or threw. The button has already returned to idle. The button shows no error state of its own, so report the failure here (a toast, a field error). Needs the action shape. @param error - The rejection reason
onMenuOpenChangeMenuOpenChangeHandler—Called when the menu opens or closes from user or platform input.
pendingLabelLocalizedMessage—Label while onAction is pending. Announced to assistive technology when it appears. Needs the action shape.
preventFocusOnPressbooleanfalseWhen true, mousedown does not move focus to the button (field adornments).
refRef<HTMLButtonElement>—Ref to the rendered button.
sizeButtonSize—Control size. Defaults to {@link ButtonSize.Large}.
successLabelLocalizedMessage—Label while the success state shows. Announced to assistive technology when it appears. Needs the action shape.
tooltipLocalizedMessage—Short text shown in a Tooltip while the pointer hovers the button or a navigation key focuses it. Button composes Tooltip's trigger, content and root, so it behaves like Tooltip > TooltipTrigger > Button and also works while disabled (pointer only) and on toggle buttons. A labelled button points aria-describedby at the tooltip. An icon-only button does not: label already names it, so the tooltip is visual only and never read twice. Adding or removing the prop after mount remounts the button.
type"button" | "submit" | "reset"—Native button type. Defaults to button.
variantButtonVariant—Surface variant. Defaults to {@link ButtonVariant.Soft}.
Storybook
Interactive examples and edge cases for this component are in Storybook.
DefaultOpens in a new tab
Primary
Secondary
With lead icon
Sizes
Disabled
All variants
Previous
Split button / Usage
Next
Split button / Accessibility
On this page
Props
Storybook
Primary
Secondary
With lead icon
Sizes
Disabled
All variants