Talisman LogoTalisman Logo Design System
Browse documentation
Components

Dropdown Menu

A menu of actions that opens from a button, with items, checkboxes, radio options, groups and submenus, built on Radix Dropdown Menu.

Stableimport { DropdownMenu } from "@repo/ui/dropdown-menu";Source

Select the button to open the menu. Use the arrow keys to move, Enter to choose and Escape to close.

When to use

  • To group several actions on one item behind a single button: “Ações da tarefa”.
  • For a row action menu in a table, behind an icon button labelled “Mais ações”.
  • For options that toggle or switch a view setting: visible columns, sort order.

When not to use

  • A single action. Use a Button.
  • A main action with a few alternatives. Use Button menu, a split button.
  • Choosing a value for a form field. Use Select, which shows the chosen value in the field.
  • Searching a long list of commands or pages. Use Command.
  • Actions on right click. Use Context menu, and keep the same actions reachable from a visible button.
  • Rich content, forms or explanations. A menu holds actions only. Use a Dialog or a Sheet.

Which one to use

Component Opens with Holds Use for
Dropdown menu A button Actions, toggles, radio options Actions on an item, view settings
Context menu Right click, long press The same kinds of items Shortcuts for power users on an area
Button menu A split button Alternatives to the main action “Enviar para revisão” and its variations
Select A field Values, one chosen Form fields
Command A search field Actions and pages, filtered Global search and shortcuts

Anatomy

Part Role
DropdownMenu Holds the open state.
DropdownMenuTrigger The element that opens it. Use asChild with a Button.
DropdownMenuContent The popup. Rendered in a portal, 4px from the trigger by default.
DropdownMenuItem One action. 44px tall.
DropdownMenuCheckboxItem An on/off option with a check on the right.
DropdownMenuRadioGroup, DropdownMenuRadioItem One option out of several, with a dot on the right.
DropdownMenuLabel A heading for a group of items.
DropdownMenuGroup Groups items for assistive technology.
DropdownMenuSeparator A line between groups.
DropdownMenuShortcut Right-aligned hint of a keyboard shortcut. It does not bind the keys.
DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent A nested menu opened from an item with a chevron.

Examples

Actions with icons

Put the most common action first and separate destructive actions at the end.

Label, shortcuts and a disabled item

Icon trigger

An icon-only trigger needs an aria-label.

Checkbox items

A checkbox item closes the menu when chosen. Call event.preventDefault() in onSelect to keep it open while the user toggles several options.

Radio items

Searchable

searchable adds a search field at the top. The component does not filter: keep the query with onSearchChange and render only the matching items.

Content

  • Start each item with a verb: “Duplicar tarefa”, “Reatribuir revisor”.
  • Use sentence case and keep labels under about 30 characters.
  • Use the same label as the dialog or page the item leads to.
  • Group related items and separate groups with a DropdownMenuSeparator. Put destructive actions last.
  • Disable an item instead of hiding it when the action exists but is not available now.

Do and don’t

DoGroup related actions and put the destructive one last, after a separator.
Don'tDon't mix the destructive action with the others, or put it first. It is one slip away.

Accessibility

  • Built on Radix Dropdown Menu. The trigger has aria-haspopup="menu" and aria-expanded. The popup has role="menu" and items have menuitem, menuitemcheckbox or menuitemradio, with aria-checked on the last two.
  • Keyboard: Enter, Space or ArrowDown on the trigger opens the menu. ArrowUp and ArrowDown move, Home and End jump, typing letters jumps to a matching item, Enter or Space chooses, ArrowRight opens a submenu, ArrowLeft closes it and Escape closes the menu. Focus returns to the trigger.
  • Menu items are 44px tall, above the 24px minimum hit target.
  • Disabled items stay in the menu, are skipped by arrow keys and carry aria-disabled.
  • The trigger needs an accessible name. An icon-only trigger needs aria-label.
  • While open, the menu is modal: the page behind is inert and pointer-events are disabled. Pass modal={false} to change it.

Code

import { Button } from "@repo/ui/button";
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuSeparator,
  DropdownMenuTrigger,
} from "@repo/ui/dropdown-menu";

<DropdownMenu>
  <DropdownMenuTrigger asChild>
    <Button variant="secondary">Ações da tarefa</Button>
  </DropdownMenuTrigger>
  <DropdownMenuContent align="start">
    <DropdownMenuItem onSelect={handleSend}>
      Enviar para revisão
    </DropdownMenuItem>
    <DropdownMenuItem onSelect={handleDuplicate}>
      Duplicar tarefa
    </DropdownMenuItem>
    <DropdownMenuSeparator />
    <DropdownMenuItem onSelect={handleDelete}>Excluir tarefa</DropdownMenuItem>
  </DropdownMenuContent>
</DropdownMenu>;

Props

DropdownMenu
PropTypeDefaultDescription
defaultOpenbooleanfalseInitial open state when the menu is uncontrolled
modalbooleantrueBlocks interaction with the rest of the page while open
onOpenChange(open: boolean) => void—Called when the menu opens or closes
openboolean—Controlled open state
DropdownMenuContent
PropTypeDefaultDescription
align"start" | "center" | "end""center"Alignment against the trigger.
side"top" | "right" | "bottom" | "left""bottom"Preferred side. The menu flips when there is no room.
sideOffsetnumber4Distance from the trigger in pixels.
searchablebooleanfalseRenders a search field above the items.
searchPlaceholderstring"Pesquisar..."Placeholder of the search field. Pass translated copy from the app.
onSearchChange(value: string) => void—Called with the query when the search field changes. The component does not filter the items.
containerHTMLElement | null—Element to render the portal into. Defaults to the document body.
DropdownMenuItem
PropTypeDefaultDescription
onSelect(event: Event) => void—Called when the item is chosen. The menu closes afterwards unless you call `event.preventDefault()`.
disabledbooleanfalsePrevents choosing the item.
insetbooleanfalseAdds left padding to align with items that have an indicator. Also on DropdownMenuLabel and DropdownMenuSubTrigger.
asChildbooleanfalseRenders the child element, for example a link, instead of a div.
DropdownMenuCheckboxItem
PropTypeDefaultDescription
checkedboolean | 'indeterminate'—Controlled checked state.
onCheckedChange(checked: boolean) => void—Called when the user toggles the item.
DropdownMenuRadioGroup, DropdownMenuRadioItem
PropTypeDefaultDescription
valuestring—On DropdownMenuRadioGroup: the selected value. On DropdownMenuRadioItem: the value of the option.
onValueChange(value: string) => void—On DropdownMenuRadioGroup: called when the user picks an option.
DropdownMenuSubContent
PropTypeDefaultDescription
containerHTMLElement | null—Element to render the submenu portal into.

Known issues

Issue Effect
searchPlaceholder defaults to the Portuguese string "Pesquisar...". The package should stay free of app copy. An app that forgets the prop shows Portuguese in every locale.
The search field calls stopPropagation on every keydown. Arrow keys typed in the field never reach the menu, so they do not move focus to the items.
Disabled items use data-[disabled]:opacity-50. The repository avoids opacity-based disabled states, and the label contrast drops below the AA minimum.
The popup shadow is the hardcoded shadow-[0px_25px_25px_rgba(0,0,0,0.15)]. A raw color value outside the token system, and translucent.
There is no destructive item style. “Excluir” looks like any other item, so apps tell it apart only by position and a separator.
Items and labels use raw text-sm and text-xs classes instead of Typography. The text does not follow the type scale tokens.
Edit this page on GitHub