Dropdown
A menu or action surface opened from a trigger.
When to use
Use Dropdown when a page has more operations than can remain visible or when actions depend on a trigger context.
Examples
API
Dropdown, Dropdown.Button, and their props are exported from @ceebee/ui/client.
When selecting an item dismisses the menu, focus returns to its trigger before a dialog opened
by that item mounts. Closing the dialog can then return focus to the same durable trigger.
Multiple-selection menus that remain open retain their menu focus. Upstream props, forwarded
trigger refs, and onOpenChange notifications remain available.
Enter activates the menu item once; its default click is consumed before focus moves, so it cannot
also activate the newly opened dialog's first button.
Keep the trigger mounted while its dialog is open. Avoid restoring focus to the dismissed menu item, which may no longer exist. Arrow navigation and menu activation retain the upstream keyboard contract; a dialog owns its own Tab loop and Escape dismissal.
Dropdown
| Property | Description | Type | Default | Version |
|---|---|---|---|---|
arrow | Whether the dropdown arrow should be visible | boolean | { pointAtCenter: boolean } | false | — |
autoAdjustOverflow | Whether to adjust dropdown placement automatically when dropdown is off screen | boolean | true | 5.2.0 |
classNames | Customize class for each semantic structure inside the Dropdown component. Supports object or function. | Record<SemanticDOM, string> | (info: { props }) => Record<SemanticDOM, string> | - | — |
disabled | Whether the dropdown menu is disabled | boolean | - | — |
destroyPopupOnHide | Whether destroy dropdown when hidden, use destroyOnHidden instead | boolean | false | — |
destroyOnHidden | Whether destroy dropdown when hidden | boolean | false | 5.25.0 |
dropdownRender | Customize dropdown content, use popupRender instead | (menus: ReactNode) => ReactNode | - | 4.24.0 |
popupRender | Customize popup content | (menus: ReactNode) => ReactNode | - | 5.25.0 |
getPopupContainer | To set the container of the dropdown menu. The default is to create a div element in body, but you can reset it to the scrolling area and make a relative reposition. Example on CodePen | (triggerNode: HTMLElement) => HTMLElement | () => document.body | — |
menu | The menu props | MenuProps | - | — |
overlayClassName | The class name of the dropdown root element, please use classNames.root instead | string | - | — |
overlayStyle | The style of the dropdown root element, please use styles.root instead | CSSProperties | - | — |
placement | Placement of popup menu: top topLeft topRight bottom bottomLeft bottomRight left leftTop leftBottom right rightTop rightBottom | string | bottomLeft | left leftTop leftBottom right rightTop rightBottom: 6.5.0 |
styles | Customize inline style for each semantic structure inside the Dropdown component. Supports object or function. | Record<SemanticDOM, CSSProperties> | (info: { props }) => Record<SemanticDOM, CSSProperties> | - | — |
trigger | The trigger mode which executes the dropdown action. Note that hover can't be used on touchscreens | Array<click|hover|contextMenu> | \[hover] | — |
open | Whether the dropdown menu is currently open | boolean | - | — |
onOpenChange | Called when the open state is changed. Not trigger when hidden by click item | (open: boolean, info: { source: 'trigger' | 'menu' }) => void | - | info.source: 5.11.0 |