Skip to content
Alea0.1

Actions

ButtonGroup and SplitButton

Related buttons joined into one control, and a main action with a menu of related ones.

Ant Design: Space.Compact, Dropdown.Button

import { ButtonGroup, SplitButton } from '@alea/ui';

Examples

Attached buttons and a split button

The group joins the shapes; the split button adds a menu.

Props

ButtonGroup props

Related buttons side by side, joined into one control (Ant Space.Compact, MUI ButtonGroup).

PropTypeDefaultDescription
aria-labelstring-What the buttons do together, for screen readers ("Text alignment").
attachedbooleantrueJoins the buttons into one shape. Default true; false only spaces them.
classNamestring-Extra class names for the root element.
orientation"horizontal" | "vertical"'horizontal'horizontal (default) or vertical.

SplitButton props

A main action plus a menu of related ones (Ant Dropdown.Button, MUI split button).

PropTypeDefaultDescription
actionsrequired{ id: Key; label: string; icon?: ReactNode; description?: string | undefined; }[]-The other actions in the menu: id, label (and an optional icon or description).
childrenrequiredReactNode-The main action's label.
classNamestring-Extra class names for the root element.
fullWidthboolean-Stretches to the width of its container.
iconEndReactNode-Icon after the label.
iconStartReactNode-Icon before the label.
isLoadingboolean-Shows a spinner, keeps the width and tells screen readers it is busy.
menuLabelstring'More options'Name of the menu button. Default "More options".
onAction((id: Key) => void)-Called with the id of the menu action picked.
size"sm" | "md" | "lg"'md'sm 32 px, md 40 px (default), lg 48 px.
variant"primary" | "secondary" | "ghost" | "danger" | "link"'primary'primary: the dark gradient button; secondary: the chip (white on dark, black on light); ghost: outlined; danger: destructive; link: text only.

Accessibility

  • The group has role group; give it an aria-label when the buttons only make sense together (Zoom, Alignment).
  • The split button's menu button has its own name (More options) and opens a real menu.

Keyboard

KeyDoes
TabMoves between the buttons
Enter or Space (menu button)Opens the menu
Arrow keysMove in the menu

Do and don't

Do

  • Put the most common action on the split button's face.

Don't

  • Don't hide destructive actions in the menu without a confirmation.

In Figma

Button group set with 2 to 4 attached buttons; Split button with Variant and Size.

Tested with axe, keyboard and screen reader roles