Dropdown
Flat command menus: opening, links, keyboard, placement, themes, and table actions.
When to use
Dropdown places a small list of commands next to a button or link. It is suitable for table row, export and select operation actions. For permanent hierarchical navigation use Menu, for custom content use Popover.
Dropdown CSS Prefixes show global ConfigProvider.prefixCls and local prefixCls without resetting state. trigger and popup use the Dropdown prefix, the internal menu uses the suffix -menu. The button retains a common prefix. Changing the name does not close the popup and maintains the command focus.
Commands and methods for opening
Pass a button as children and commands as menu.items. An item with children opens a submenu. A command with href remains a native link.
| Problem | Setting | Example |
|---|---|---|
| Open next to the button | menu, children |
Main scenario |
| Work with touch | trigger="click" |
Opening methods |
| Add links and dangerous commands | href, disabled, danger |
Composition of items |
| Main and additional action | SpaceCompact, Button, Dropdown |
Composite button |
| Store discovery in app | bind:open |
Managed state |
The menu opens on hover by default. Use click for a touch screen or contextMenu to open commands at the pointer on a right-click.
Select and close
The item's onClick is called first, then menu.onClick. Both receive key and domEvent. If the item handler called domEvent.preventDefault(), the general callback is not called. Canceling in any of these handlers also keeps the menu open and cancels the native link transition.
In the controlled example, onOpenChange(open, { source }) shows what requested the change. The button, hover, Escape, Tab and outside clicks report trigger. Selecting a command requests a close with menu after menu.onClick. When both selectable and multiple are enabled, selecting an item keeps the menu open.
Without an external open, the component stores the opening itself. Updating spread props preserves the current open or closed state and focus; the update itself does not call onOpenChange. defaultOpen is read only when created. When the outer open is removed, the component reverts to the original defaultOpen rather than the last managed value. Breadcrumb prefix change shows saving an already open Dropdown when updating the owner.
loading belongs to the nested Button, disabled should also be set to Dropdown. The component does not launch the request itself: the application stores the waiting state and the result of the operation.
Position, Keyboard and API Boundaries
Choose one of the twelve placements. The side and alignment can change near a viewport edge. Use align to adjust the offset and arrow.pointAtCenter to point at the middle of the trigger.
Local getPopupContainer takes precedence over ConfigProvider.getPopupContainer; undefined saves provider fallback. Popup uses the browser's native popover and top layer. Moving the DOM into a container does not make it a regular stacking context node, and zIndexPopup itself does not reorder the top layer.
ArrowDown/ArrowUp on trigger opens the first/last available action. The menu has arrows, Home/End and text search; Escape returns focus, Tab allows you to move on. For snippet signatures, set textValue.
ConfigProvider.dropdown supplies shared panel and item classes and styles. Use the design tokens in theme.components.Dropdown to style the whole component family.
Examples
Basic menu
By default, the menu opens on hover. The native button also opens it from the keyboard; ArrowDown moves focus to the first available action.
<script lang="ts">
import { Button, Dropdown } from '@woodger/antd';
let result = $state(("Action not selected"));
</script>
<style>
output {
display: block;
margin-top: 16px;
}
</style>
<Dropdown aria-label={("Basic commands")} menu={({
items: [
{ key: 'open', label: "Open" },
{ key: 'copy', label: "Duplicate" },
{ key: 'export', label: "Export" }
],
onClick: ({ key }) => result = key
})}>
<Button>{("Point or open ")}<span aria-hidden="true">⌄</span></Button>
</Dropdown>
<output aria-label={("Basic Dropdown result")}>{result}</output>
Menu position
Twelve placements around the button. The menu can flip near a viewport edge.
<script lang="ts">
import { Button, Dropdown, type DropdownPlacement } from '@woodger/antd';
const placements: readonly DropdownPlacement[] = [
'topLeft', 'top', 'topRight', 'bottomLeft', 'bottom', 'bottomRight',
'leftTop', 'left', 'leftBottom', 'rightTop', 'right', 'rightBottom'
];
</script>
<style>
.placements {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
</style>
<div class="placements">
{#each placements as placement (placement)}
<Dropdown {placement} trigger="click" aria-label={("Position " + String((placement)) + "")}
menu={({
items: [{ key: 'first', label: "First action" }, {
key: 'second',
label: "Second act"
}]
})}>
<Button>{(placement)}</Button>
</Dropdown>
{/each}
</div>
Links, separator and states
href creates a real a. Inaccessible items are skipped by the keyboard; danger denotes a dangerous command, and divider separates actions.
<script lang="ts">
import { Button, Dropdown } from '@woodger/antd';
let result = $state(("Command not selected"));
</script>
<style>
output {
display: block;
margin-top: 16px;
}
</style>
{#snippet icon()}<span aria-hidden="true">↗</span>{/snippet}
<Dropdown trigger="click" aria-label={("Links and Dropdown states")} menu={({
items: [
{ key: 'buttons', label: "Examples of buttons", href: '/ant-design/components/button', icon },
{ key: 'unavailable', label: "Unavailable action", disabled: true },
{ key: 'separator', type: 'divider' },
{ key: 'delete', label: "Delete draft", danger: true },
{ key: 'export', label: "Export", children: [
{ key: 'csv', label: 'CSV' }, { key: 'json', label: 'JSON' }
] }
],
selectable: true,
defaultSelectedKeys: ['csv'],
onClick: ({ key }) => result = key
})}><Button>{("Links and commands")}</Button></Dropdown>
<output aria-label={("Result of Dropdown states")}>{result}</output>
Opening method
hover works with the mouse, click works with the mouse and touch. In combo mode, pressing keeps the menu open after the pointer moves away.
<script lang="ts">
import { Button, Dropdown, type DropdownTrigger } from '@woodger/antd';
let mode = $state<DropdownTrigger | 'both'>('click');
let trigger = $derived<readonly DropdownTrigger[]>(mode === 'both' ? ['hover', 'click'] : [mode]);
</script>
<style>
label {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
margin-bottom: 16px;
}
select {
max-width: 100%;
font: inherit;
}
</style>
<label>{("Opening method Dropdown ")}<select bind:value={mode}>
<option value="hover">
{("Guidance")}
</option>
<option value="click">
{("Press")}
</option>
<option value="contextMenu">{("Right-click")}</option>
<option value="both">{("Point and click")}</option>
</select></label>
<Dropdown {trigger} aria-label={("Commands of the selected trigger")}
menu={({
items: [{ key: 'first', label: "Open section" }, {
key: 'second',
label: "Open settings"
}]
})}>
<Button>{("Open menu")}</Button>
</Dropdown>
Own item label
A Svelte snippet combines the command label and shortcut hint.
<script lang="ts">
import { Button, Dropdown } from '@woodger/antd';
let result = $state(("Command not selected"));
</script>
<style>
.label {
display: flex;
align-items: center;
justify-content: space-between;
gap: 24px;
}
kbd {
color: var(--ant-color-text-description);
font: inherit;
font-size: 12px;
}
output {
display: block;
margin-top: 16px;
}
</style>
{#snippet copy()}<span
class="label"
><span>{("Copy")}</span><kbd
aria-hidden="true"
>Ctrl C</kbd></span>{/snippet}
{#snippet paste()}<span
class="label"
><span>{("Insert")}</span><kbd
aria-hidden="true"
>Ctrl V</kbd></span>{/snippet}
<Dropdown trigger="click" aria-label={("Teams with their labels")} menu={({
items: [
{ key: 'copy', label: copy, textValue: "Copy" },
{ key: 'paste', label: paste, textValue: "Insert" }
],
onClick: ({ key }) => result = key
})}><Button>{("Commands with hints")}</Button></Dropdown>
<output aria-label={("Dropdown label result")}>{result}</output>
Arrow
pointAtCenter points the arrow at the center of the button.
<script lang="ts">
import { Button, Checkbox, Dropdown } from '@woodger/antd';
let arrow = $state(true);
</script>
<style>.controls { margin-bottom:16px; }</style>
<div
class="controls"
><Checkbox
bind:checked={arrow}
>{("Arrow Dropdown")}</Checkbox></div>
<Dropdown arrow={arrow && { pointAtCenter: true }} placement="bottomLeft" trigger="click" aria-label={("Arrow menu")}
menu={({
items: [{ key: 'settings', label: "Project settings" }, {
key: 'access',
label: "Access rights"
}]
})}>
<Button>{("Menu in the center of the button")}</Button>
</Dropdown>
Menu with a note
Enter a note and reopen the menu. With destroyOnHidden the field is created again.
<script lang="ts">
import { Button, Checkbox, ConfigProvider, Dropdown, Input } from '@woodger/antd';
import type { Snippet } from 'svelte';
let destroy = $state(false);
let open = $state(false);
let trigger = $state<Element>();
function close() {
open = false;
if (trigger instanceof HTMLElement) {
trigger.focus();
}
}
</script>
{#snippet popupRender(origin?: Snippet)}
<div class="draft">
{@render origin?.()}
<Input aria-label={("Note")} placeholder={("Note")} />
<Button onclick={close}>{("Close")}</Button>
</div>
{/snippet}
<div class="controls">
<Checkbox bind:checked={destroy}>{("Remove the panel when closed")}</Checkbox>
<ConfigProvider dropdown={{ styles: { root: 'padding:8px' } }}>
<Dropdown
{popupRender}
bind:open
bind:ref={trigger}
forceRender={!destroy}
destroyOnHidden={destroy}
trigger="click"
menu={{ items: [{ key: 'docs', label: ("Documents") }] }}
>
<Button>{("Commands and note")}</Button>
</Dropdown>
</ConfigProvider>
</div>
<style>
.controls {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 16px;
}
.draft {
display: grid;
gap: 8px;
}
</style>
Action handlers
The onClick of the item is called first, then the general menu.onClick. key belongs to the application; domEvent allows you to cancel navigation and closing of a menu.
<script lang="ts">
import { Button, Dropdown } from '@woodger/antd';
let events = $state<string[]>([]);
</script>
<style>
output {
display: block;
margin-top: 16px;
}
</style>
<Dropdown trigger="click" aria-label={("Commands with handlers")} menu={({
items: [
{
key: 'copy', label: "Copy entry", onClick: ({ key }) => events = [
...events,
`item:${key}`
]
},
{ key: 'export', label: "Export recording" }
],
onClick: ({ key }) => events = [...events, `menu:${key}`]
})}><Button>{("Execute and record")}</Button></Dropdown>
<output aria-label={("Events Dropdown")}>{(events.join(' → ')
|| ("No events"))}</output>
Closing control
By default, selecting closes the menu. In this example, preventDefault keeps it open for intermediate commands; “Done” closes in the usual way.
<script lang="ts">
import { Button, Checkbox, Dropdown } from '@woodger/antd';
let keep = $state(true);
let count = $state(0);
</script>
<style>
.controls {
margin-bottom: 16px;
}
output {
display: block;
margin-top: 16px;
}
</style>
<div
class="controls"
><Checkbox
bind:checked={keep}
>{("Leave menu open")}</Checkbox></div>
<Dropdown trigger="click" aria-label={("Menu with closing control")} menu={({
items: [{ key: 'add', label: "Add mark" }, { key: 'done', label: "Ready" }],
onClick: ({ key, domEvent }) => {
if (key === 'add') {
count++;
if (keep) domEvent.preventDefault();
}
}
})}><Button>{("Several actions in a row")}</Button></Dropdown>
<output
aria-label={("Dropdown Marks")}
>{("Added: ")}{count}</output>
Controlled opening
The onOpenChange log shows when the button opens the menu and when a command closes it. Updating open from application code does not add a log entry.
<script lang="ts">
import { Button, Dropdown } from '@woodger/antd';
let open = $state(false);
let changes = $state<string[]>([]);
</script>
<style>
.controls {
display: flex;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 16px;
}
output {
display: block;
margin-top: 12px;
}
</style>
<div
class="controls"
><Button
onclick={() => open = !open}
>{("Switch from outside")}</Button></div>
<Dropdown bind:open trigger="click" aria-label={("Controlled commands")}
onOpenChange={(value, { source }) => changes = [...changes, `${source} (${value})`]}
menu={({ items: [{ key: 'run', label: "Execute command" }] })}>
<Button>{("Managed Dropdown")}</Button>
</Dropdown>
<output
aria-label={("Opening Dropdown")}
>{(open ? "Open" : "Closed")}</output>
<output aria-label={("Open Requests Dropdown")}>{(changes.join(' → ')
|| ("No requests"))}</output>
Loading and unavailability
loading belongs to Button, disabled also belongs to Dropdown. The switch demonstrates a wait state without a network request or timer.
<script lang="ts">
import { Button, Checkbox, Dropdown } from '@woodger/antd';
let loading = $state(false);
</script>
<style>.controls { margin-bottom:16px; }</style>
<div
class="controls"
><Checkbox
bind:checked={loading}
>{("Loading action")}</Checkbox></div>
<Dropdown disabled={loading} trigger="click" aria-label={("Commands after loading")}
menu={({ items: [{ key: 'open', label: "Open result" }] })}>
<Button {loading}>{("Actions after loading")}</Button>
</Dropdown>
ConfigProvider Container
Popup Menu Container
ConfigProvider sets the general getPopupContainer, the local getter takes precedence. A native popover remains in the top layer of the browser, even when its DOM is inside the card container.
<script lang="ts">
import { Button, Checkbox, ConfigProvider, Dropdown } from '@woodger/antd';
let local = $state(false);
let providerTarget = $state<HTMLDivElement>();
let localTarget = $state<HTMLDivElement>();
</script>
<style>
.controls { margin-bottom:16px; }
.targets {
display: grid;
gap: 12px;
}
.target {
min-height:44px;
padding:12px;
border:1px dashed var(--ant-color-border);
border-radius:6px;
}
.caption {
margin: 0 0 12px;
color: var(--ant-color-text-secondary);
}
</style>
<div
class="controls"
><Checkbox
bind:checked={local}
>{("Local container")}</Checkbox></div>
<ConfigProvider getPopupContainer={() => providerTarget!}>
<div class="targets">
<div class="target provider-target" bind:this={providerTarget}>
<p class="caption">{("ConfigProvider Container")}</p>
<Dropdown getPopupContainer={local ? () => localTarget! : undefined}
trigger="click" aria-label={("Commands in the container")}
menu={({
items: [{ key: 'one', label: "First team" }, {
key: 'two',
label: "Second team"
}]
})}>
<Button>{("Open menu in container")}</Button>
</Dropdown>
</div>
<div
class="target local-target"
bind:this={localTarget}
>{("Local container")}</div>
</div>
</ConfigProvider>
Component tokens
The local theme sets the paddingBlock of points and zIndexPopup. Adjacent menus follow the same theme; switching padding does not close the open menu.
<script lang="ts">
import { Button, ConfigProvider, Dropdown } from '@woodger/antd';
let padding = $state(10);
</script>
<style>
label {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
margin-bottom: 16px;
}
</style>
<label>{("Vertical paragraph indent ")}<input
type="range"
min="4"
max="16"
bind:value={padding}
/>
<output>{padding}px</output>
</label>
<ConfigProvider theme={{
cssVar: {}, components: {
Dropdown: {
paddingBlock: padding,
zIndexPopup: 1060
}
}
}}>
<Dropdown trigger="click" arrow aria-label={("Teams with their own theme")}
menu={({
items: [{ key: 'one', label: "Theme settings" }, {
key: 'two',
label: "Project parameters"
}]
})}>
<Button>{("Menu with its own indents")}</Button>
</Dropdown>
</ConfigProvider>
Interface direction
direction is inherited from ConfigProvider. Without explicit placement, RTL selects bottomRight; a long label is wrapped within the available window width.
<script lang="ts">
import { Button, Checkbox, ConfigProvider, Dropdown } from '@woodger/antd';
let rtl = $state(true);
</script>
<style>.controls { margin-bottom:16px; }</style>
<div class="controls"><Checkbox bind:checked={rtl}>RTL Dropdown</Checkbox></div>
<ConfigProvider direction={rtl ? 'rtl' : 'ltr'}>
<Dropdown
trigger="click"
arrow
aria-label={("Interface direction commands")}
menu={({
items: [
{ key: 'settings', label: "Project settings with a long name" },
{ key: 'archive', label: "Project archive", danger: true }
]
})}
><Button>{("Menu with direction")}</Button></Dropdown>
</ConfigProvider>
Member | Role | Status | Actions |
|---|---|---|---|
| Анна | Разработчик | Active | |
| Михаил | Дизайнер | Active |
Actions in the participants table
Saved review example: the menu opens the member card, creates a copy and sends the line to the archive. The list and result belong to the application.
<script lang="ts">
import {
Button,
Checkbox,
Dropdown,
Modal,
Table,
type DropdownPlacement,
type TableColumn
} from '@woodger/antd';
interface Member {
key: number;
name: string;
role: string;
archived: boolean;
}
const initialMembers: Member[] = [
{ key: 1, name: "Anna", role: "Developer", archived: false },
{ key: 2, name: "Mikhail", role: "Designer", archived: false }
];
let members = $state(initialMembers.map((member) => ({ ...member })));
let nextKey = 3;
let selected = $state<Member>();
let modalOpen = $state(false);
let hover = $state(false);
let arrow = $state(true);
let placement = $state<DropdownPlacement>('bottomRight');
let result = $state(("Select an action from the participant row."));
const columns: TableColumn<Member>[] = [
{ key: 'name', title: "Member", dataIndex: 'name' },
{ key: 'role', title: "Role", dataIndex: 'role' },
{ key: 'status', title: "Status", render: status },
{ key: 'actions', title: "Actions", render: actions }
];
function choose(key: string, member: Member) {
if (key === 'details') {
selected = member;
modalOpen = true;
}
if (key === 'copy') {
members = [...members, { ...member, key: nextKey++, name: `${member.name} (copy)` }];
result = ("" + String((member.name)) + ": A copy has been created.");
}
if (key === 'archive') {
members = members.map(
(item) => item.key === member.key ? { ...item, archived: true } : item
);
result = ("" + String((member.name)) + ": moved to archive.");
}
}
</script>
<style>
.settings {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 12px;
margin-bottom: 24px;
}
.settings label {
display: flex;
align-items: center;
gap: 8px;
}
select {
padding: 4px 8px;
color: var(--ant-color-text);
background: var(--ant-color-bg-container);
border: 1px solid var(--ant-color-border);
border-radius: 6px;
font: inherit;
}
.footer {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 16px;
margin-top: 20px;
}
output { color: var(--ant-color-text-secondary); }
</style>
{#snippet detailsIcon()}<span>↗</span>{/snippet}
{#snippet status(member: Member)}
<span>
{(member.archived ? "Archived" : "Active")}
</span>
{/snippet}
{#snippet actions(member: Member)}
<Dropdown
aria-label={("Actions: " + String((member.name)) + "")}
trigger={hover ? ['hover', 'click'] : ['click']}
{placement}
{arrow}
menu={({
items: [
{ key: 'details', label: "Open card", icon: detailsIcon },
{ key: 'copy', label: "Create a copy" },
{ key: 'divider', type: 'divider' },
{ key: 'archive', label: "To the archive", danger: true, disabled: member.archived }
],
onClick: ({ key }) => choose(key, member)
})}
>
<Button size="small" aria-label={("Actions: " + String((member.name)) + "")}>{("Actions ")}<span aria-hidden="true">⌄</span></Button>
</Dropdown>
{/snippet}
<div class="settings">
<Checkbox bind:checked={hover}>{("Open on hover")}</Checkbox>
<Checkbox bind:checked={arrow}>{("Show arrow")}</Checkbox>
<label>{("Menu position ")}<select
bind:value={placement}
><option
value="bottomLeft"
>{("Bottom left")}</option><option
value="bottom"
>{("Bottom center")}</option><option
value="bottomRight"
>{("Bottom right")}</option><option
value="topLeft"
>{("Top left")}</option><option
value="top"
>{("Top center")}</option><option
value="topRight"
>{("Top right")}</option></select></label>
</div>
<Table
dataSource={(members)}
columns={(columns)}
pagination={(false)}
caption={("Participants with action menu")}
scroll={{ x: 620 }}
/>
<div class="footer">
<Button
onclick={() => {
members = initialMembers.map((member) => ({ ...member }));
nextKey = 3;
result = ("The list of participants has been restored.");
}}
>{("Restore participants")}</Button>
<output aria-label={("Menu action result")}>{result}</output>
</div>
<Modal bind:open={modalOpen} title={(selected ? `Card: ${selected.name}` : "Member profile")}><p>{(selected?.role)}</p><p>{(selected?.archived ? "The participant is archived." : "Member is active.")}</p></Modal>
Trigger and popup use the Dropdown prefix, the internal menu uses the suffix -menu. The button retains a common prefix. Changing the name does not close the popup and maintains the command focus.
CSS prefixes Dropdown
Common namespace ConfigProvider and local prefixCls; the state of the component is preserved when the name is changed.
<script lang="ts">
import { Checkbox, ConfigProvider, Dropdown, Button } from '@woodger/antd';
let custom = $state(true);
let local = $state(true);
const prefix = $derived(custom ? 'suite' : 'ant');
const localPrefix = $derived(local ? 'project-dropdown' : '');
let selected = $state('—');
</script>
<style>
.example,
.prefix-stage {
display: grid;
grid-template-columns: minmax(0, 1fr);
gap: 16px;
min-width: 0;
}
.controls {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
p { margin: 0; }
output { overflow-wrap: anywhere; }
</style>
<div class="example">
<div class="controls">
<Checkbox bind:checked={custom}>{("Common prefix Dropdown suite")}</Checkbox>
<Checkbox bind:checked={local}>{("Local Prefix Dropdown")}</Checkbox>
</div>
<ConfigProvider prefixCls={prefix} theme={{ cssVar: { prefix: 'dropdown-theme' } }}>
<div class="prefix-stage">
<Dropdown prefixCls={localPrefix} trigger="click" menu={({
items: [{ key: 'save', label: "Save with prefix" }, {
key: 'copy',
label: "Copy with prefix"
}],
onClick: info => selected = String(info.key)
})}>
{#snippet children()}
<Button>
{("Open Dropdown with prefix")}
</Button>
{/snippet}
</Dropdown>
<output aria-label={("Dropdown command with prefix")}>{selected}</output>
</div>
</ConfigProvider>
<output
aria-label={("CSS prefix Dropdown")}
>{("General: ")}{prefix}{("; local: ")}{(localPrefix
|| ("from the provider"))}</output>
<p>
{("Trigger and popup use the Dropdown prefix, the internal menu uses the suffix -menu. The button retains a common prefix. Changing the name does not close the popup and maintains the command focus.")}
</p>
</div>
API
Examples are checked against the current ant.design page and the public API of the installed package. Full definitions of Props are in @woodger/antd.
| Theme | Example or limitation |
|---|---|
| Basic | Opening hover and from the keyboard; selection of flat commands. |
| Placement | Twelve placements around the button. The menu can flip near a viewport edge. |
| Other elements | Links, disabled, danger and separator. |
| Trigger mode | Pointing, clicking and their combination. |
| Button with dropdown menu | Composition of SpaceCompact, Button and Dropdown. |
| Cascading menu | Add children to an item to open a nested list of commands. |
| Context Menu | Right-click to open the menu at the pointer. |
| Selectable Menu | Enable menu.selectable to mark the selected command. |
| Custom semantic dom styling | Set shared panel and item classNames and styles through ConfigProvider.dropdown. |
| Extra node | Pass a shortcut hint as extra or render it inside the label. |
| Arrow | With arrow=true the arrow follows the panel placement. |
| Arrow pointing at the center | pointAtCenter points the arrow at the center of the button. |
| Click event | Separate and common handlers receive key and domEvent. |
| Custom dropdown | popupRender places the standard menu and a note field in the same panel. |
| The way of hiding menu. | Controlled opening and preventDefault to save the menu after an intermediate command. |
| Loading | Download belongs to Button; unavailability is synced with Dropdown. |
| Selection actions | The original example uses the Selection API along with the extended popup API; There is no ready-made adaptation in the current Dropdown. |
| Property | Description | Type | Default |
|---|---|---|---|
popupRender | Adds elements to the menu or supplies the complete panel content. | Snippet<[origin?: Snippet]> | — |
destroyOnHidden | Unmounts the panel contents after closing and finishing the transition. | boolean | false |
forceRender | Mounts the hidden panel on the client before it first opens. | boolean | false |
autoFocus | Moves focus into the open menu, including when opened on hover. | boolean | false |
align | Adjusts alignment points, offsets and corrections near viewport edges. | TooltipAlignConfig | — |
prefixCls | Full CSS prefix of the component and its parts. A non-empty local prop takes precedence; empty string and undefined inherit ConfigProvider. The namespace of the topic is set separately. | string | ConfigProvider.prefixCls + "-dropdown" |
children | Native button or other available trigger. Keep name and keyboard handling accessible. | Snippet | Mandatory |
menu | Add children to an item to open a nested list of commands. | DropdownMenuProps | — |
trigger | Open on hover, click or right-click. | DropdownTrigger | readonly DropdownTrigger[] | ['hover'] |
open | bind:open synchronizes state, including command closure. Without an external open, updating props preserves internal state; removing external control returns the original defaultOpen. | boolean | undefined | defaultOpen |
defaultOpen | Initial opening; subsequent changes do not reinitialize the component. | boolean | false |
onOpenChange | info.source is trigger for button interactions, Escape, Tab and outside clicks. A command that closes the menu reports menu. | (open: boolean, info: DropdownOpenChangeInfo) => void | — |
disabled | Explicit prop specifies inherited unavailability. | boolean | From Form or ConfigProvider |
placement | Twelve placements around the button. The menu can flip near a viewport edge. | DropdownPlacement | bottomLeft; in RTL bottomRight |
arrow | pointAtCenter points the arrow at the center of the button. | boolean | DropdownArrowOptions | false |
autoAdjustOverflow | Allows you to adjust placement at the edge of the window. | boolean | AdjustOverflow | true |
mouseEnterDelay | Hover opening delay in seconds. | number | 0.1 |
mouseLeaveDelay | Hover closing delay in seconds. | number | 0.1 |
getPopupContainer | Local getter takes precedence. undefined saves fallback provider. | (triggerNode: HTMLElement) => HTMLElement | From ConfigProvider |
aria-label | Available name of the pop-up menu. | string | From trigger |
aria-labelledby | ID of the element that provides the popup's accessible name. | string | — |
class | trigger shell class, not popup. | string | — |
style | Styles the trigger wrapper. Use styles.root for the panel. | string | — |
Item parameters
A command can provide href, icon, extra and an onClick handler. The menu.onClick event carries key, keyPath, itemData and domEvent.
Semantic DOM
trigger shell - span; children must contain an accessible native control. The component adds aria-haspopup, aria-expanded and aria-controls to it. Popup - native popover with ul role=menu; commands are created as a button or a with role=menuitem, the separator hides interactivity.
ArrowDown/ArrowUp on trigger opens the menu from the first/last available item. The menu has arrows, Home/End and text search. Escape closes the menu and returns focus. Tab leaves the menu. Inaccessible items are skipped.
bind:ref exposes the trigger element. rootClassName styles the panel and openClassName marks the open trigger.
Registration tokens
Public paddingBlock and zIndexPopup are set via ConfigProvider theme.components.Dropdown. The card changes the vertical padding of items in an isolated topic. A native popover participates in the top layer of the browser: one zIndexPopup does not change the order relative to other elements in the top layer.
Technical arrow tokens are also present in the package types; For usual examples, arrow and placement are enough. The overall colors and typography follow the theme of the section.
| Token | Purpose |
|---|---|
paddingBlock | Vertical indentation of menu items. |
zIndexPopup | CSS z-index surface popup; taking into account the native top layer. |
| Token | Current value |
|---|---|
colorBgElevated | #ffffff |
colorText | rgba(0,0,0,0.88) |
colorTextDisabled | rgba(0,0,0,0.25) |
colorError | #ff4d4f |
colorPrimary | #2f54eb |
controlItemBgHover | rgba(0,0,0,0.04) |
borderRadiusLG | 8 |
fontSize | 14 |
lineHeight | 1.5714285714285714 |
FAQ
How to leave the menu open after a command?
Call domEvent.preventDefault() in the item or menu.onClick handler. Please note that this will also cancel the link.
Why didn't onOpenChange report the choice?
A command normally requests a close with onOpenChange(false, { source: 'menu' }). The menu stays open if a handler calls domEvent.preventDefault() or if both selectable and multiple are enabled. Use menu.onClick to handle the command itself.
Why is hover inconvenient on a phone?
touch has no hover. Specify click or a combined trigger.
Is it possible to nest a form or submenu?
Give an item children to create a submenu. In the note example, popupRender adds an input beside the commands. Its value survives closing by default. With destroyOnHidden, reopening creates an empty field.