Skip to Content
ComponentsOverlayDropdown Menu

Dropdown Menu

An overlay component that displays a contextual menu of choices when triggered by a button. 
For more information on this component configuration, visit Radix UI 

Disabled Item

Use the disabled attr or the disabled class to disable an item component.

Sizes

Use the dropdown-menu-content-{size} class to control the component size.

Size values can include:smmd.

For more information on all available sizing utilities, visit Tailwind 

Customizing

globals.css
:root { --ex-dropdown-menu-max-w-sm: var(--container-3xs); --ex-dropdown-menu-max-w-md: var(--container-2xs); --ex-dropdown-menu-radius-sm: var(--radius-sm); --ex-dropdown-menu-radius-md: var(--radius-sm); --ex-dropdown-menu-shadow-sm: var(--shadow-sm); --ex-dropdown-menu-shadow-md: var(--shadow-sm); --ex-dropdown-menu-section-gap-x-sm: calc(var(--spacing) * 1.5); --ex-dropdown-menu-section-gap-x-md: calc(var(--spacing) * 2); --ex-dropdown-menu-section-px-sm: calc(var(--spacing) * 1.5); --ex-dropdown-menu-section-px-md: calc(var(--spacing) * 2); --ex-dropdown-menu-section-py-sm: calc(var(--spacing) * 2); --ex-dropdown-menu-section-py-md: calc(var(--spacing) * 2.5); --ex-dropdown-menu-item-px-sm: calc(var(--spacing) * 2); --ex-dropdown-menu-item-px-md: calc(var(--spacing) * 2); --ex-dropdown-menu-item-py-sm: var(--spacing); --ex-dropdown-menu-item-py-md: var(--spacing); --ex-dropdown-menu-item-font-family: var(--font-sans); --ex-dropdown-menu-item-font-weight: var(--font-weight-normal); --ex-dropdown-menu-item-font-size-sm: var(--text-xs); --ex-dropdown-menu-item-font-size-md: var(--text-sm); --ex-dropdown-menu-item-indicator-font-size-sm: var(--text-xs); --ex-dropdown-menu-item-indicator-font-size-md: var(--text-sm); --ex-dropdown-menu-label-font-family: var(--font-sans); --ex-dropdown-menu-label-font-weight: var(--font-weight-normal); --ex-dropdown-menu-label-opacity: var(--ex-options-opacity-muted); --ex-dropdown-menu-label-font-size-sm: var(--text-2xs); --ex-dropdown-menu-label-font-size-md: var(--text-xs); --ex-dropdown-menu-command-font-family: var(--font-sans); --ex-dropdown-menu-command-font-weight: var(--font-weight-normal); --ex-dropdown-menu-command-opacity: var(--ex-options-opacity-muted); --ex-dropdown-menu-command-font-size-sm: var(--text-2xs); --ex-dropdown-menu-command-font-size-md: var(--text-xs); --ex-dropdown-menu-arrow-height-sm: calc(var(--spacing) * 1.75); --ex-dropdown-menu-arrow-height-md: calc(var(--spacing) * 1.75); --ex-dropdown-menu-arrow-width-sm: calc(var(--spacing) * 3.5); --ex-dropdown-menu-arrow-width-md: calc(var(--spacing) * 3.5); }

API

For more information on this component configuration, visit Radix UI 

PropTypeDefault
asElementTypediv
asChildbooleanfalse
defaultOpenbooleanfalse
modalbooleantrue
openbooleanfalse
onOpenChangefunction
ElementSelector
DropdownMenu.Trigger.ex-dropdown-menu-trigger
PropTypeDefault
asElementTypediv
asChildbooleanfalse
PropTypeDefault
containerHTMLElementdocument.body
forceMountbooleanfalse
ElementSelector
DropdownMenu.Content.ex-dropdown-menu-content
PropTypeDefault
asElementTypediv
asChildbooleanfalse
alignenum of ["start", "center", "end"]center
alignOffsetnumber0
arrowPaddingnumber0
avoidCollisionsbooleantrue
forceMountbooleanfalse
hideWhenDetachedbooleanfalse
loopbooleanfalse
sideenum of ["top", "right", "bottom", "left"]bottom
sideOffsetnumber0
stickyenum of ["always", "partial"]partial
onCloseAutoFocusfunction
onFocusOutsidefunction
onInteractOutsidefunction
onPointerDownOutsidefunction
ElementSelector
ContextMenu.Section.ex-dropdown-menu-body
PropTypeDefault
asElementTypediv
asChildbooleanfalse
ElementSelector
DropdownMenu.Arrow.ex-dropdown-menu-arrow
PropTypeDefault
asChildbooleanfalse
ElementSelector
DropdownMenu.Item.ex-dropdown-menu-item
PropTypeDefault
asElementTypediv
asChildbooleanfalse
disabledbooleanfalse
textValuestring
onSelectfunction
ElementSelector
DropdownMenu.ItemIndicator.ex-dropdown-menu-item-indicator
PropTypeDefault
asElementTypediv
asChildbooleanfalse
forceMountbooleantrue
ElementSelector
DropdownMenu.Label.ex-dropdown-menu-label
PropTypeDefault
asElementTypediv
asChildbooleanfalse
ElementSelector
DropdownMenu.Command.ex-dropdown-menu-command
PropTypeDefault
asElementTypekbd
asChildbooleanfalse
ElementSelector
DropdownMenu.Separator.ex-dropdown-menu-separator
PropTypeDefault
asElementTypediv
asChildbooleanfalse
ElementSelector
DropdownMenu.RadioGroup.ex-dropdown-menu-radio-group
PropTypeDefault
asElementTypediv
asChildbooleanfalse
valuestring
onValueChangefunction
ElementSelector
DropdownMenu.RadioItem.ex-dropdown-menu-radio-item
PropTypeDefault
asElementTypediv
asChildbooleanfalse
disabledbooleanfalse
textValuestring
valuestring
onSelectfunction
ElementSelector
DropdownMenu.CheckboxItem.ex-dropdown-menu-checkbox-item
PropTypeDefault
asElementTypediv
asChildbooleanfalse
checkedbooleanfalse
disabledbooleanfalse
textValuestring
onCheckedChangefunction
onSelectfunction
ElementSelector
DropdownMenu.Sub.ex-dropdown-menu-sub
PropTypeDefault
asElementTypediv
asChildbooleanfalse
defaultOpenbooleanfalse
openbooleanfalse
onOpenChangefunction
ElementSelector
DropdownMenu.SubTrigger.ex-dropdown-menu-sub-trigger
PropTypeDefault
asElementTypediv
asChildbooleanfalse
disabledbooleanfalse
textValuestring
ElementSelector
DropdownMenu.SubContent.ex-dropdown-menu-sub-content
PropTypeDefault
asElementTypediv
asChildbooleanfalse
alignOffsetnumber-8
arrowPaddingnumber0
avoidCollisionsbooleantrue
forceMountbooleanfalse
hideWhenDetachedbooleanfalse
loopbooleanfalse
sideOffsetnumber0
stickyenum of ["always", "partial"]partial
onFocusOutsidefunction
onInteractOutsidefunction
onPointerDownOutsidefunction
Last updated on