Navigated to /docs/ui/components/dropdown-menu

DropdownMenu

Trigger-driven menu of contextual commands with menu semantics and keyboard item navigation.

Preview

A live, theme-aware example rendered with the published component.

Loading preview…

Import

Import the component from its dedicated entry point to keep the dependency and generated bundle explicit.

TSX
tsximport { DropdownMenu } from "@tavojs/ui/dropdown-menu";

Normal Tavo.js applications load component styles through the Tavo.js UI plugin. If the application manages component CSS manually, also import @tavojs/ui/css/dropdown-menu.

When to use

Use it when

Use DropdownMenu for a compact list of actions such as Edit, Duplicate, Archive, or Download.

Choose something else when

Use Popover when the floating surface contains arbitrary content, fields, filters, or explanations rather than a command list.

Examples

DropdownMenu example

TSX
tsximport { DropdownMenu } from "@tavojs/ui/dropdown-menu";

export function DropdownMenuExample1() {
  return (
    <>
      <DropdownMenu>
        <DropdownMenu.Trigger>Actions</DropdownMenu.Trigger>
        <DropdownMenu.Content>
          <DropdownMenu.Item href="/settings">Settings</DropdownMenu.Item>
        </DropdownMenu.Content>
      </DropdownMenu>
    </>
  );
}

Common props and defaults

PropTypeDefaultDescription
classNamestring

Optional class hook applied to the public root element owned by the component.
openboolean

Configures open for this component.
align"start" | "end"

Configures align for this component.
onClose() => void

Configures onClose for this component.

Complete TypeScript API

Import from @tavojs/ui/dropdown-menu. Published exports: DropdownMenu, DropdownMenuContent, DropdownMenuContentProps, DropdownMenuItem, DropdownMenuItemProps, DropdownMenuProps, DropdownMenuRoot, DropdownMenuTrigger, DropdownMenuTriggerProps.

DropdownMenuProps

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by DropdownMenu.

classNamestring

No

Optional class hook applied to the public root element owned by the component.

sxSx

No

Inherited sx attribute accepted by DropdownMenu.

idstring

No

Inherited id attribute accepted by DropdownMenu.

rolestring

No

Inherited role attribute accepted by DropdownMenu.

styleRecord<string, unknown>

No

Inherited style attribute accepted by DropdownMenu.

titlestring

No

Inherited title attribute accepted by DropdownMenu.

tabIndexnumber

No

Inherited tabIndex attribute accepted by DropdownMenu.

hiddenboolean

No

Inherited hidden attribute accepted by DropdownMenu.

disabledboolean

No

Inherited disabled attribute accepted by DropdownMenu.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by DropdownMenu.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by DropdownMenu.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by DropdownMenu.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by DropdownMenu.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by DropdownMenu.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by DropdownMenu.

openboolean

No

Configures open for this component.

align"start" | "end"

No

Configures align for this component.

onClose() => void

No

Configures onClose for this component.

DropdownMenuTriggerProps

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by DropdownMenu.

classNamestring

No

Optional class hook applied to the public root element owned by the component.

sxSx

No

Inherited sx attribute accepted by DropdownMenu.

idstring

No

Inherited id attribute accepted by DropdownMenu.

rolestring

No

Inherited role attribute accepted by DropdownMenu.

styleRecord<string, unknown>

No

Inherited style attribute accepted by DropdownMenu.

titlestring

No

Inherited title attribute accepted by DropdownMenu.

tabIndexnumber

No

Inherited tabIndex attribute accepted by DropdownMenu.

hiddenboolean

No

Inherited hidden attribute accepted by DropdownMenu.

disabledboolean

No

Inherited disabled attribute accepted by DropdownMenu.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by DropdownMenu.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by DropdownMenu.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by DropdownMenu.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by DropdownMenu.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by DropdownMenu.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by DropdownMenu.

labelstring

No

Inherited label attribute accepted by DropdownMenu.

DropdownMenuContentProps

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by DropdownMenu.

classNamestring

No

Optional class hook applied to the public root element owned by the component.

sxSx

No

Inherited sx attribute accepted by DropdownMenu.

idstring

No

Inherited id attribute accepted by DropdownMenu.

rolestring

No

Inherited role attribute accepted by DropdownMenu.

styleRecord<string, unknown>

No

Inherited style attribute accepted by DropdownMenu.

titlestring

No

Inherited title attribute accepted by DropdownMenu.

tabIndexnumber

No

Inherited tabIndex attribute accepted by DropdownMenu.

hiddenboolean

No

Inherited hidden attribute accepted by DropdownMenu.

disabledboolean

No

Inherited disabled attribute accepted by DropdownMenu.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by DropdownMenu.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by DropdownMenu.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by DropdownMenu.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by DropdownMenu.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by DropdownMenu.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by DropdownMenu.

DropdownMenuItemProps

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by DropdownMenu.

classNamestring

No

Optional class hook applied to the public root element owned by the component.

sxSx

No

Inherited sx attribute accepted by DropdownMenu.

idstring

No

Inherited id attribute accepted by DropdownMenu.

rolestring

No

Inherited role attribute accepted by DropdownMenu.

styleRecord<string, unknown>

No

Inherited style attribute accepted by DropdownMenu.

titlestring

No

Inherited title attribute accepted by DropdownMenu.

tabIndexnumber

No

Inherited tabIndex attribute accepted by DropdownMenu.

hiddenboolean

No

Inherited hidden attribute accepted by DropdownMenu.

disabledboolean

No

Inherited disabled attribute accepted by DropdownMenu.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by DropdownMenu.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by DropdownMenu.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by DropdownMenu.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by DropdownMenu.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by DropdownMenu.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by DropdownMenu.

hrefstring

No

Inherited href attribute accepted by DropdownMenu.

State ownership and DOM target

ConcernContract
StateApplication controlled through open and the matching callback.
DOM targetPublic passthrough props target the component root. Treat nested elements and private class names as implementation details.

Anatomy and related components

Public compound members: Root, Trigger, Content, Item

Limitations

Use Popover when the floating surface contains arbitrary content, fields, filters, or explanations rather than a command list.

Use only the documented props, entry points, and compound members. Internal DOM nesting and CSS class names can change without becoming part of the public component contract.

Accessibility

Content uses `role="menu"` and items use `role="menuitem"`.

  • Content uses `role="menu"` and items use `role="menuitem"`.

Component status

ContractCurrent value
Maturitystable
Categoryfeedback
Component import@tavojs/ui/dropdown-menu
Explicit CSS import@tavojs/ui/css/dropdown-menu
PreviewInteractive preview available on this page