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.
Import
Import the component from its dedicated entry point to keep the dependency and generated bundle explicit.
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
Choose something else when
Examples
DropdownMenu example
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
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Optional class hook applied to the public root element owned by the component. |
open | boolean | — | 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
| Property | Type | Required | Description |
|---|---|---|---|
children | Child | No | Inherited children attribute accepted by DropdownMenu. |
className | string | No | Optional class hook applied to the public root element owned by the component. |
sx | Sx | No | Inherited sx attribute accepted by DropdownMenu. |
id | string | No | Inherited id attribute accepted by DropdownMenu. |
role | string | No | Inherited role attribute accepted by DropdownMenu. |
style | Record<string, unknown> | No | Inherited style attribute accepted by DropdownMenu. |
title | string | No | Inherited title attribute accepted by DropdownMenu. |
tabIndex | number | No | Inherited tabIndex attribute accepted by DropdownMenu. |
hidden | boolean | No | Inherited hidden attribute accepted by DropdownMenu. |
disabled | boolean | No | Inherited disabled attribute accepted by DropdownMenu. |
onClick | TavoEventHandler<MouseEvent> | No | Inherited onClick attribute accepted by DropdownMenu. |
onChange | TavoEventHandler<Event> | No | Inherited onChange attribute accepted by DropdownMenu. |
onInput | TavoEventHandler<Event> | No | Inherited onInput attribute accepted by DropdownMenu. |
onKeyDown | TavoEventHandler<KeyboardEvent> | No | Inherited onKeyDown attribute accepted by DropdownMenu. |
onFocus | TavoEventHandler<FocusEvent> | No | Inherited onFocus attribute accepted by DropdownMenu. |
onBlur | TavoEventHandler<FocusEvent> | No | Inherited onBlur attribute accepted by DropdownMenu. |
open | boolean | No | Configures open for this component. |
align | "start" | "end" | No | Configures align for this component. |
onClose | () => void | No | Configures onClose for this component. |
DropdownMenuTriggerProps
| Property | Type | Required | Description |
|---|---|---|---|
children | Child | No | Inherited children attribute accepted by DropdownMenu. |
className | string | No | Optional class hook applied to the public root element owned by the component. |
sx | Sx | No | Inherited sx attribute accepted by DropdownMenu. |
id | string | No | Inherited id attribute accepted by DropdownMenu. |
role | string | No | Inherited role attribute accepted by DropdownMenu. |
style | Record<string, unknown> | No | Inherited style attribute accepted by DropdownMenu. |
title | string | No | Inherited title attribute accepted by DropdownMenu. |
tabIndex | number | No | Inherited tabIndex attribute accepted by DropdownMenu. |
hidden | boolean | No | Inherited hidden attribute accepted by DropdownMenu. |
disabled | boolean | No | Inherited disabled attribute accepted by DropdownMenu. |
onClick | TavoEventHandler<MouseEvent> | No | Inherited onClick attribute accepted by DropdownMenu. |
onChange | TavoEventHandler<Event> | No | Inherited onChange attribute accepted by DropdownMenu. |
onInput | TavoEventHandler<Event> | No | Inherited onInput attribute accepted by DropdownMenu. |
onKeyDown | TavoEventHandler<KeyboardEvent> | No | Inherited onKeyDown attribute accepted by DropdownMenu. |
onFocus | TavoEventHandler<FocusEvent> | No | Inherited onFocus attribute accepted by DropdownMenu. |
onBlur | TavoEventHandler<FocusEvent> | No | Inherited onBlur attribute accepted by DropdownMenu. |
label | string | No | Inherited label attribute accepted by DropdownMenu. |
DropdownMenuContentProps
| Property | Type | Required | Description |
|---|---|---|---|
children | Child | No | Inherited children attribute accepted by DropdownMenu. |
className | string | No | Optional class hook applied to the public root element owned by the component. |
sx | Sx | No | Inherited sx attribute accepted by DropdownMenu. |
id | string | No | Inherited id attribute accepted by DropdownMenu. |
role | string | No | Inherited role attribute accepted by DropdownMenu. |
style | Record<string, unknown> | No | Inherited style attribute accepted by DropdownMenu. |
title | string | No | Inherited title attribute accepted by DropdownMenu. |
tabIndex | number | No | Inherited tabIndex attribute accepted by DropdownMenu. |
hidden | boolean | No | Inherited hidden attribute accepted by DropdownMenu. |
disabled | boolean | No | Inherited disabled attribute accepted by DropdownMenu. |
onClick | TavoEventHandler<MouseEvent> | No | Inherited onClick attribute accepted by DropdownMenu. |
onChange | TavoEventHandler<Event> | No | Inherited onChange attribute accepted by DropdownMenu. |
onInput | TavoEventHandler<Event> | No | Inherited onInput attribute accepted by DropdownMenu. |
onKeyDown | TavoEventHandler<KeyboardEvent> | No | Inherited onKeyDown attribute accepted by DropdownMenu. |
onFocus | TavoEventHandler<FocusEvent> | No | Inherited onFocus attribute accepted by DropdownMenu. |
onBlur | TavoEventHandler<FocusEvent> | No | Inherited onBlur attribute accepted by DropdownMenu. |
DropdownMenuItemProps
| Property | Type | Required | Description |
|---|---|---|---|
children | Child | No | Inherited children attribute accepted by DropdownMenu. |
className | string | No | Optional class hook applied to the public root element owned by the component. |
sx | Sx | No | Inherited sx attribute accepted by DropdownMenu. |
id | string | No | Inherited id attribute accepted by DropdownMenu. |
role | string | No | Inherited role attribute accepted by DropdownMenu. |
style | Record<string, unknown> | No | Inherited style attribute accepted by DropdownMenu. |
title | string | No | Inherited title attribute accepted by DropdownMenu. |
tabIndex | number | No | Inherited tabIndex attribute accepted by DropdownMenu. |
hidden | boolean | No | Inherited hidden attribute accepted by DropdownMenu. |
disabled | boolean | No | Inherited disabled attribute accepted by DropdownMenu. |
onClick | TavoEventHandler<MouseEvent> | No | Inherited onClick attribute accepted by DropdownMenu. |
onChange | TavoEventHandler<Event> | No | Inherited onChange attribute accepted by DropdownMenu. |
onInput | TavoEventHandler<Event> | No | Inherited onInput attribute accepted by DropdownMenu. |
onKeyDown | TavoEventHandler<KeyboardEvent> | No | Inherited onKeyDown attribute accepted by DropdownMenu. |
onFocus | TavoEventHandler<FocusEvent> | No | Inherited onFocus attribute accepted by DropdownMenu. |
onBlur | TavoEventHandler<FocusEvent> | No | Inherited onBlur attribute accepted by DropdownMenu. |
href | string | No | Inherited href attribute accepted by DropdownMenu. |
State ownership and DOM target
| Concern | Contract |
|---|---|
| State | Application controlled through open and the matching callback. |
| DOM target | Public passthrough props target the component root. Treat nested elements and private class names as implementation details. |
Anatomy and related components
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
| Contract | Current value |
|---|---|
| Maturity | stable |
| Category | feedback |
| Component import | @tavojs/ui/dropdown-menu |
| Explicit CSS import | @tavojs/ui/css/dropdown-menu |
| Preview | Interactive preview available on this page |