Skip to content
Components

DropdownMenu

Dropdown menu for actions, resources, labels, separators, and submenus.

Composition

Actions and selection

Content includes its portal and positioner.

  • <DropdownMenu>
    • <DropdownMenuTrigger />
    • <DropdownMenuContent>
      • <DropdownMenuGroup>
        • <DropdownMenuLabel />
        • <DropdownMenuItem>
          • <DropdownMenuShortcut />
          </DropdownMenuItem>
        • <DropdownMenuCheckboxItem />
        </DropdownMenuGroup>
      • <DropdownMenuSeparator />
      • <DropdownMenuRadioGroup>
        • <DropdownMenuRadioItem />
        </DropdownMenuRadioGroup>
      • <DropdownMenuSub>
        • <DropdownMenuSubTrigger />
        • <DropdownMenuSubContent>
          • <DropdownMenuItem />
          </DropdownMenuSubContent>
        </DropdownMenuSub>
      </DropdownMenuContent>
    </DropdownMenu>

Custom portal content

Use the portal only when supplying your own popup instead of DropdownMenuContent.

  • <DropdownMenu>
    • <DropdownMenuTrigger />
    • <DropdownMenuPortal>
      • custom positioned popup
      </DropdownMenuPortal>
    </DropdownMenu>

Installation

The Control UI source installs this primitive from src/registry/sources/control-ui/ui/dropdown-menu.tsx.

Registry command
See registry manifest

Dependencies

Popup item focussrc/registry/lib/popup-item-focus.tsUtil
Surface variantssrc/registry/sources/control-ui/surface-variants.tsSupport
Control variantssrc/registry/sources/control-ui/control-variants.tsSupport

Raw code

Primary installed source

src/registry/sources/control-ui/ui/dropdown-menu.tsx

Knobs

Typed custom properties the recipe paints with. Set one on the root — style, a utility class, or a skin — and every slot inherits it.

--cui-button-radius<length-percentage>var(--nest-radius, var(--radius-control))
--cui-button-gap<length-percentage>calc(var(--spacing) * 1.5)
--cui-button-icon<length>1rem
--cui-button-height<length-percentage>var(--control-h-md)
--cui-button-padding-inline<length-percentage>var(--padding-x)
--cui-button-icon-padding-inline<length-percentage>max(0px, calc(var(--cui-button-padding-inline) - var(--spacing) * 0.5))
--cui-button-font-size<length-percentage>var(--text-body)
--cui-button-background<color>transparent
--cui-button-background-image*none
--cui-button-hover-background-image*var(--cui-button-background-image)
--cui-button-foreground<color>var(--muted-foreground)
--cui-button-hover-background<color>var(--hover-fill)
--cui-button-hover-foreground<color>var(--foreground)
--cui-button-press-background<color>var(--cui-button-hover-background)
--cui-button-press-scale<number>0.96
--cui-button-active-background<color>var(--active-fill)
--cui-button-active-foreground<color>var(--foreground)
--cui-button-active-hover-background<color>var(--cui-button-active-background)
--cui-button-shadow*0 0 transparent
--cui-button-hover-shadow*var(--cui-button-shadow)
--cui-button-press-shadow*var(--cui-button-hover-shadow)
--cui-button-active-shadow*var(--cui-button-shadow)
--cui-button-open-background<color>var(--cui-button-hover-background)
--cui-button-open-foreground<color>var(--cui-button-hover-foreground)
--cui-button-open-shadow*var(--cui-button-shadow)
--cui-popup-* · 44 knobsHow the cascade resolves
--cui-popup-title-foreground<color>var(--cui-popup-foreground)
--cui-popup-title-font-size<length-percentage>var(--text-heading-3)
--cui-popup-title-font-weight<number>var(--font-weight-semibold)
--cui-popup-title-line-height<number>var(--text-heading-3--line-height)
--cui-popup-title-letter-spacing<length>-0.025em
--cui-popup-description-foreground<color>var(--muted-foreground)
--cui-popup-close-inset<length-percentage>calc(var(--spacing) * 3)
--cui-popup-item-inset<length-percentage>calc(var(--spacing) * 8)
--cui-popup-label-padding-block<length-percentage>var(--cui-popup-item-padding-block)
--cui-popup-label-padding-inline<length-percentage>var(--cui-popup-item-padding-inline)
--cui-popup-label-font-size<length-percentage>var(--text-micro)
--cui-popup-label-font-weight<number>var(--font-weight-medium)
--cui-popup-label-letter-spacing<length>0.08em
--cui-popup-label-text-transformnone | uppercase | lowercase | capitalizeuppercase
--cui-popup-separator-inset<length-percentage>calc(var(--popover-padding) * -1)
--cui-popup-shortcut-font-size<length-percentage>var(--text-body)
--cui-popup-shortcut-letter-spacing<length>0.02em
--cui-popup-status-success-foreground<color>var(--success-text)
--cui-popup-status-warning-foreground<color>var(--warning-text)
--cui-popup-status-info-foreground<color>var(--info-text)
--cui-popup-status-error-foreground<color>var(--destructive)
--cui-popup-radius<length-percentage>var(--radius-popover)
--cui-popup-background<color>var(--popover)
--cui-popup-foreground<color>var(--popover-foreground)
--cui-popup-border-color<color>var(--control-rim)
--cui-popup-border-width<length>var(--control-rim-width)
--cui-popup-shadow*var(--shadow-pop)
--cui-popup-backdrop-filter*blur(var(--backdrop-blur-popover))
--cui-popup-backdrop-background<color>oklch(from var(--foreground) l c h / var(--overlay-opacity))
--cui-popup-backdrop-blur<length>var(--backdrop-blur-overlay)
--cui-popup-item-radius<length-percentage>var(--radius-popup-item-fit)
--cui-popup-item-font-size<length-percentage>var(--text-body)
--cui-popup-item-icon-size<length-percentage>1rem
--cui-popup-item-padding-block<length-percentage>calc(var(--spacing) * 1)
--cui-popup-item-padding-inline<length-percentage>calc(var(--padding-x) * 0.5)
--cui-popup-item-min-height<length-percentage>max(var(--target-min), var(--control-h-xs))
--cui-popup-item-highlight-shadow*inset 0 0 0 1px oklch(from var(--foreground) l c h / 0.35)
--cui-popup-item-foreground<color>var(--foreground)
--cui-popup-item-highlight-background<color>var(--hover-fill)
--cui-popup-item-highlight-foreground<color>var(--cui-popup-item-foreground)
--cui-popup-item-highlight-muted-foreground<color>var(--muted-foreground)
--cui-popup-item-disabled-opacity<number>var(--disabled-opacity)
--cui-popup-separator-color<color>var(--border)
--cui-popup-shortcut-foreground<color>var(--muted-foreground)