JGuang

Dropdown

Dropdown · Arco Design

Preview
npm install @arco-design/web-react@2.66.18

Dropdown

When there are too many commands, the alternative commands can be stored in the floating container that expands downward.

Install

npm install @arco-design/web-react@2.66.18

Import @arco-design/web-react/dist/css/arco.css at the entry and set the locale with ConfigProvider. React 19 projects must also import @arco-design/web-react/es/_util/react-19-adapter first, or imperative APIs such as Message and Modal cannot render.

Examples

  • Basic: Basic usage of Dropdown.
  • Position of popup: Six popup position are available: top, tl: top-left, tr: top-right, bottom, bl: bottom-left (default), br: bottom-right。
  • Extra node: Disable menu items and insert dividing lines.
  • Trigger mode: Specify the trigger mode by trigger.
  • Callback for MenuItem: Use Menu.onClickMenuItem to specify the callback function to be triggered when the menu item is clicked.
  • Dropdown with button: Use <Dropdown.Button> to use the Dropdown with button on its right side which are additional menus.
  • With SubMenu: Dropdown with SubMenu.
  • Control visibility of menu: Use popupVisible and onVisibleChange to control the visibility of the dropdown menu. Refer to Trigger for more details about trigger timing of onVisibleChange. If droplist is Menu, you can also prevent menu hiding by returning false in onClickMenuItem.
  • Grouped menu: Group menu items by Menu.ItemGroup.
  • Right click menu: Right click to trigger menu.
  • Menu with icons: You can add icons before menu items.

Examples come from the official Arco Design repository (MIT) at the commit published as npm 2.66.18. Some use online images or upload endpoints; network requests are disabled in previews.

API

PropertyDescriptionTypeDefaultValueVersion
defaultPopupVisibleWhether the dropdown list is visible by defaultboolean--
disabledWhether to disable popupboolean-2.16.0
popupVisibleWhether the dropdown list is visible (Controlled)boolean--
unmountOnExitWhether to umount the node on hidingbooleantrue-
positionPosition of dropdown list'top' | 'tl' | 'tr' | 'bottom' | 'bl' | 'br'bl-
triggerTypes of events that cause the popup to showTriggerProps['trigger']hover-
droplistContent of dropdown listReactNode--
triggerPropsPass all Trigger component propertiesPartial<TriggerProps>--
getPopupContainerTo set the container of the dropdown menu(node: HTMLElement) => Element--
onVisibleChangeCallback when visibility changes(visible: boolean) => void--
PropertyDescriptionTypeDefaultValueVersion
defaultPopupVisibleWhether the dropdown list is visible by defaultboolean--
disabledWhether to disable popupboolean-2.16.0
popupVisibleWhether the dropdown list is visible (Controlled)boolean--
unmountOnExitWhether to umount the node on hidingbooleantrue-
positionPosition of the dropdown list'top' | 'tl' | 'tr' | 'bottom' | 'bl' | 'br'br-
sizeSame as size of ButtonProps'mini' | 'small' | 'default' | 'large'--
triggerTypes of events that cause the popup to showTriggerProps['trigger']hover-
typeSame as type of ButtonProps'default' | 'primary' | 'secondary' | 'dashed' | 'outline' | 'text'default-
droplistContent of dropdown listReactNode--
iconCustom icon on the rightReactNode<IconMore />-
buttonPropsPass Button's properties to the button on the leftButtonProps--
classNameAdditional css classstring | string[]--
styleAdditional styleCSSProperties--
triggerPropsPass all Trigger component propertiesPartial<TriggerProps>--
buttonsRenderCustom buttons inside Dropdown.Button(buttons: ReactNode[]) => ReactNode[]--
getPopupContainerTo set the container of the dropdown menu(node: HTMLElement) => Element--
onClickCallback when button on the left is clicked(e: Event) => void--
onVisibleChangeCallback when visibility changes(visible: boolean) => void--