Talisman LogoTalisman Logo Design System
Browse documentation
Components

Button Menu

A split button with a main action on the left and a chevron that opens a menu of related actions, sharing the variants and sizes of Button.

Stableimport { ButtonMenu } from "@repo/ui/button-menu";Source
size
variant
<ButtonMenu label="Enviar para revisão" menuAriaLabel="Mais opções de envio" size="sm" variant="primary" />

Select the chevron to open the menu. It opens above the button.

When to use

  • When one action is the usual choice and a few related actions are the alternatives: “Enviar para revisão” with “Enviar e arquivar” in the menu.
  • When the alternatives are variations of the same task, not separate tasks.
  • In footers and toolbars where space allows only one button.

When not to use

  • A single action. Use Button.
  • A menu with no default action. Use a Button that opens a Dropdown menu.
  • Navigation between pages. Use links or Tabs.
  • More than about six alternatives. Use a Dropdown menu or a Dialog.

Variants

The variants mirror Button. When no variant is passed, the component is secondary.

Variant Use for
primary The most important action in an area. One per area.
secondary Default. A supporting action next to a primary.
tertiary A low-emphasis action with a surface fill and a dark stroke.
inverted High contrast: dark fill on light themes.
ghost The lowest emphasis: no fill or border, a separator on hover.
critical Destructive or irreversible actions, such as cancel or delete.

Sizes

sm is the default. The sizes have the same heights as Button.

Size Height Use for
lg 56px Prominent actions and large footers.
md 48px Prominent actions, touch screens.
sm 40px Default. Forms and page headers.
xs 36px Compact layouts and toolbars.
xxs 32px Tables and dense lists.

States

Hover shows a layer over the whole component when the pointer is on the main button, and a rounded pill over the chevron when it is on the chevron. The chevron keeps the pill while the menu is open. Disabled turns off both buttons.

Examples

Shortcut and icon

shortcut shows before the label at reduced emphasis. leadingIcon and trailingIcon take 16px Lucide icons.

Destructive

Without menu items

When menuItems is missing or empty, the chevron is a plain button that calls onMenuClick. Use it when the app renders its own menu or dialog.

Content

  • The label names the default action: “Enviar para revisão”, “Gerar contestação”.
  • Menu items name the variation, not the whole action again: “Enviar e arquivar”, “Enviar para outro revisor”.
  • Put the least destructive item first. Keep destructive items last and name what they affect: “Descartar rascunho”.
  • Always pass menuAriaLabel in the user’s language, for example “Mais opções de envio”. The default is English.

Do and don’t

DoGive the menu related alternatives of the main action.
Don'tDon't use it for one action. A Button is simpler and has one hit target.

Accessibility

  • It renders two native <button> elements, so Enter and Space activate each one. Tab moves from the main button to the chevron.
  • With menuItems, the chevron is the trigger of a Radix Dropdown Menu: it sets aria-haspopup="menu" and aria-expanded, and the menu supports arrow keys, type-ahead and Escape, and returns focus to the chevron on close.
  • The chevron has no text, so menuAriaLabel is its accessible name. Pass a translated string; the default is “Open menu”.
  • Use aria-label on the main button when it has no visible label.
  • Disabled items in the menu are skipped by arrow-key navigation.
  • Without menuItems, the chevron has no aria-haspopup or aria-expanded. If your onMenuClick opens a menu, set up those attributes in your own menu.
  • Keyboard focus has no custom style. See Known issues.

Code

import { ButtonMenu } from "@repo/ui/button-menu";

<ButtonMenu
  label="Enviar para revisão"
  menuAriaLabel="Mais opções de envio"
  menuItems={[
    { label: "Enviar e arquivar", onClick: sendAndArchive },
    { label: "Enviar para outro revisor", onClick: sendToOther },
    { disabled: true, label: "Enviar com anexos" },
  ]}
  onContentClick={send}
  variant="primary"
/>;

Props

ButtonMenu
PropTypeDefaultDescription
aria-labelstring—Accessible name of the main button. Required when there is no visible label
disabledbooleanfalseDisables both the main button and the chevron
labelstring—Text of the main button
leadingIconReactNode—Icon before the label
menuAriaLabelstringOpen menuAccessible name of the chevron button. Pass translated copy from the app
menuItemsButtonMenuItem[]—Actions listed in the menu. When empty or missing, the chevron calls `onMenuClick` instead
onContentClickfunction—Click handler of the main button
onMenuClickMouseEventHandler<HTMLButtonElement>—Click handler of the chevron. Used only when `menuItems` is not provided
shortcutstring—Keyboard shortcut shown before the label
size"lg" | "md" | "sm" | "xs" | "xxs"smHeight, padding and type size
trailingIconReactNode—Icon after the label
variant"critical" | "ghost" | "inverted" | "primary" | "secondary" | "tertiary"secondaryVisual hierarchy of the action
ButtonMenuItem
PropTypeDefaultDescription
labelReactNode—Visible text of the item.
iconReactNode—Optional icon before the label.
onClick() => void—Called when the item is selected.
disabledboolean—Prevents selection and dims the item.

Also accepted: className, contentClassName and menuClassName for the container, the main button and the chevron.

Known issues

Issue Effect
The main button and the chevron have no focus-visible style. Keyboard focus shows only the browser default outline, not the --stroke-focus token.
menuAriaLabel defaults to the English string “Open menu”. Apps that forget to pass it expose English to screen readers in a Portuguese interface.
Hover and open fills are translucent: bg-black/10, bg-black/15 and hsl(var(--sys-interactive)/0.05). The repository avoids transparency. The result depends on the color behind the component.
disabled:opacity-25 dims the whole button, and shortcut uses opacity-40. Disabled and shortcut text have low contrast, and disabled does not use the disabled tokens.
The menu always opens with side="top" and align="end". It cannot open downward, so a button at the top of a page opens its menu over the content above it.
Menu items use the index as the React key. Code only: reordering a list of items while the menu is open can mix up their state.
Edit this page on GitHub