Skip to content
GitHub (opens in a new tab)

SplitButton

A main action joined to a chevron that opens a menu of related actions.

stableMoleculecontracts/splitbutton.json

Preview

SplitButton

A main action joined to a chevron that opens the other actions. It composes a kit Button and a kit DropdownMenu. For actions only: FilterButton stays the split control for filters.

Master

An invoice footer: Cancel, and Save invoice with a menu.

Nothing saved yet

Usage

The label runs the usual action. The chevron opens the rest and is named after the label, like Save invoice options. It still counts as the one solid primary in the view.

Do's

  • One action is the usual choice and a few others are close to it, like Save invoice with Save and send, or Save as draft
  • A card footer or page header where the other actions would crowd the row as separate Buttons

Don'ts

<SplitButton
  size="sm"
  onClick={save}
  onSelect={(id) => run(id)}
  groups={[{ items: [
    { id: "send", label: "Save and send", icon: "Send" },
    { id: "draft", label: "Save as draft", icon: "FileText" },
    { id: "copy", label: "Save a copy", icon: "Copy" },
  ] }]}
>
  Save invoice
</SplitButton>

When to use

  • One action is the usual choice and a few others are close to it, like Save invoice with Save and send, or Save as draft
  • A card footer or page header where the other actions would crowd the row as separate Buttons

When not to use

  • Filters above a table or list — use FilterButton
  • A menu with no main action — use DropdownMenu
  • Two or three equal actions — use separate Buttons or a ButtonGroup
  • Choosing a value to save — use Select

What an agent reads

import { SplitButton } from "agentic-ds-kit";
must
  • Two native buttons: the main action, named by its label, and the chevron, named by menuLabel
  • The chevron has aria-haspopup=menu and aria-expanded
  • The menu follows DropdownMenu: arrow keys move, Enter picks, Escape closes and returns focus to the chevron
  • Each button has its own focus ring
defaults
  • size md
  • appearance solid
  • mode primary
  • disabled false
  • loading false
  • type button
  • align end
stops if
  • Do not build a local split button from two Buttons and a popover
  • Do not use SplitButton for filters — FilterButton is the split control for filters
  • Do not put the main action in the menu as well
  • Do not use more than one appearance=solid mode=primary SplitButton or Button in a view
  • Do not use raw hex

From contracts/splitbutton.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
childrenstringYes—Label of the main action, like Save invoice.
onClickfunctionNo—Runs the main action.
groupsDropdownMenuGroup[]Yes—The other actions, as kit DropdownMenu groups: [{ heading?, items: [{ id, label, icon?, danger?, disabled? }] }].
onSelectfunctionNo—(id: string) => void. A menu action was picked.
menuLabelstringNo—Accessible name of the chevron button. Default: the label plus options, like Save invoice options.
sizelg | md | smNomdBoth parts use control-height: sm 32, md 36, lg 40. The chevron part is a square.
appearancesolid | outline | soft | ghostNosolid—
modeprimary | neutral | dangerNoprimary—
disabledbooleanNofalseDisables both parts.
loadingbooleanNofalseThe main action is running. Same as Button loading. The menu still opens.
iconStartKitIconNo—Leading icon on the main action.
typebutton | submit | resetNobuttonType of the main action button.
alignstart | endNoendWhich edge of the chevron the menu lines up with.
openbooleanNo—Controlled menu state. Leave it out and the menu keeps its own.
onOpenChangefunctionNo—(open: boolean) => void.
  • Component
    →

    FilterButton

    Filter chip for lists and tables: shows the filter name or its chosen value, opens its options, and turns an applied filter on or off.

  • Component
    →

    DropdownMenu

    Actions or value menu from a button, field, or nav trigger.

  • Component
    →

    ButtonGroup

    Joined row of kit Buttons that share one size and act as one control cluster.

  • Component
    →

    Select

    Choose one or several options from a list.