Capítulo 17 de 43
A menu of actions triggered by clicking a button — shares essentially the same anatomy and API surface as ContextMenu, but positions against a Trigger element instead of the pointer location.
ContextMenu — Root → Trigger → Portal → Content → Label/Item/Group/CheckboxItem/RadioGroup+RadioItem/Sub+SubTrigger+SubContent/Separator/Arrow.Trigger: unlike ContextMenu (positions at pointer), DropdownMenu's Content anchors to the Trigger element by default — same side/align/collision props as Popover.Arrow: optional pointing-arrow element, must render inside Content, visually links the menu to its trigger.export const DropdownMenuItemIndicator = React.forwardRef((props, ref) => (
<DropdownMenuPrimitive.ItemIndicator {...props} ref={ref} />
));
| Part | Notable props |
|---|---|
Root | open/onOpenChange, modal (default true), dir |
Content | side, align, alignOffset, avoidCollisions, collisionBoundary, collisionPadding, sticky, hideWhenDetached |
CheckboxItem | checked (supports "indeterminate"), onCheckedChange |
ContextMenu's API, DropdownMenu is the same shape with click-trigger positioning instead of pointer positioning — the sub-parts (Item, CheckboxItem, RadioItem, Sub) transfer directly.Arrow when the menu needs a clear visual anchor back to its trigger (common in compact toolbars); omit it for full-width or ambiguous-origin menus.--radix-dropdown-menu-content-transform-origin, --radix-dropdown-menu-content-available-*).Content positioning props (side/align/collision handling).