Vesyl UI

DropdownMenu

A menu of actions or options that opens from a button you click. Built on base-ui Menu — focus management, type-ahead, keyboard navigation, and ARIA wiring come for free.

Reach for DropdownMenu when a button reveals a list of actions (a row’s ”⋯” overflow, a “New” split button, a settings cog). It is the click-triggered sibling of ContextMenu — same items and parts, but opened by a button instead of a right-click — and of Menubar, which arranges several such menus into a persistent application bar.

Compose DropdownMenu (root), DropdownMenuTrigger (the button — pass your own via the render prop), and DropdownMenuContent (the popup), then fill the content with DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, and friends.

Basic

The trigger uses base-ui’s render prop to borrow any element — here a Button. Inside DropdownMenuContent, lay out DropdownMenuItems, group them with a DropdownMenuLabel and DropdownMenuSeparator, hint at keybindings with DropdownMenuShortcut, and flag a dangerous action with variant="destructive". A leading lucide icon auto-sizes to size-4.

Checkbox items

DropdownMenuCheckboxItem is a toggle that stays in the menu — ideal for show/hide column pickers and multi-select filters. Drive each with checked and onCheckedChange; the check indicator renders automatically.

Radio group

Wrap DropdownMenuRadioItems in a DropdownMenuRadioGroup for a single-choice set, like a sort order. The group owns the selected value and fires onValueChange; each item declares its value.

Nest a DropdownMenuSub with a DropdownMenuSubTrigger (it gets a trailing chevron) and a DropdownMenuSubContent to fan out related actions — print formats, carrier choices — without crowding the top level.

Destructive & disabled items

variant="destructive" paints an item (and its icon) in the destructive color and tints its focus background. disabled dims an item and removes it from pointer and keyboard interaction. Pass align="end" to DropdownMenuContent to right-align the popup under an overflow trigger.

Reference

Root container. Extends base-ui Menu.Root props.

PropTypeDefaultDescription
modalbooleanfalseTrap focus and block outside interaction while open
openbooleanOpen state (controlled)
defaultOpenbooleanInitial open state (uncontrolled)
onOpenChange(open) => voidFires when the menu opens or closes

The button that opens the menu. Extends base-ui Menu.Trigger props.

PropTypeDefaultDescription
render(props) => ReactElement | ReactElementRender your own trigger element (e.g. a Button) with merged props

The popup surface. Extends base-ui Menu.Popup plus positioner props.

PropTypeDefaultDescription
align"start" | "center" | "end""start"Alignment relative to the trigger
alignOffsetnumber0Pixel offset along the alignment axis
side"top" | "right" | "bottom" | "left""bottom"Which side of the trigger to open on
sideOffsetnumber4Gap between the trigger and the popup
classNamestringMerged onto the popup

A clickable action. Extends base-ui Menu.Item props.

PropTypeDefaultDescription
variant"default" | "destructive""default"Destructive paints the item and its icon red
insetbooleanfalsePad the left edge to align with items that have icons
disabledbooleanfalseDim the item and disable interaction
onClick(event) => voidFires when the item is activated

A toggleable item. Extends base-ui Menu.CheckboxItem props.

PropTypeDefaultDescription
checkedbooleanChecked state (controlled)
onCheckedChange(checked) => voidFires when the checked state changes
disabledbooleanfalseDim the item and disable interaction

Single-choice container. Extends base-ui Menu.RadioGroup props.

PropTypeDefaultDescription
valueanySelected item value (controlled)
defaultValueanyInitial value (uncontrolled)
onValueChange(value) => voidFires when the selection changes

One radio choice. Extends base-ui Menu.RadioItem props.

PropTypeDefaultDescription
valueanyIdentifies this choice in the group

Sub-parts

PartWrapsNotes
DropdownMenuLabelMenu.GroupLabelNon-interactive section heading; accepts inset
DropdownMenuSeparatorMenu.SeparatorA hairline rule between groups
DropdownMenuGroupMenu.GroupGroups items under a DropdownMenuLabel
DropdownMenuShortcutspanMuted, right-aligned keybinding hint inside an item
DropdownMenuSubMenu.SubmenuRootWraps a submenu’s trigger and content
DropdownMenuSubTriggerMenu.SubmenuTriggerOpens the submenu; renders a trailing chevron
DropdownMenuSubContentDropdownMenuContentThe nested popup; defaults to side="right"