logoAnt Design

⌘ K
  • Design
  • Development
  • Components
  • Blog
  • Resources
YouMindTRACTIANLobeHub
6.4.3
  • Components Overview
  • Changelog
    v6.4.3
  • General
    • Button
    • FloatButton
    • Icon
    • Typography
  • Layout
    • Divider
    • Flex
    • Grid
    • Layout
    • Masonry
      6.0.0
    • Space
    • Splitter
  • Navigation
    • Anchor
    • Breadcrumb
    • Dropdown
    • Menu
    • Pagination
    • Steps
    • Tabs
  • Data Entry
    • AutoComplete
    • Cascader
    • Checkbox
    • ColorPicker
    • DatePicker
    • Form
    • Input
    • InputNumber
    • Mentions
    • Radio
    • Rate
    • Select
    • Slider
    • Switch
    • TimePicker
    • Transfer
    • TreeSelect
    • Upload
  • Data Display
    • Avatar
    • Badge
    • Calendar
    • Card
    • Carousel
    • Collapse
    • Descriptions
    • Empty
    • Image
    • List
      DEPRECATED
    • Popover
    • QRCode
    • Segmented
    • Statistic
    • Table
    • Tag
    • Timeline
    • Tooltip
    • Tour
    • Tree
  • Feedback
    • Alert
    • Drawer
    • Message
    • Modal
    • Notification
    • Popconfirm
    • Progress
    • Result
    • Skeleton
    • Spin
    • Watermark
  • Other
    • Affix
    • App
    • BorderBeam
      6.4.0
    • ConfigProvider
    • Util
When To Use
Examples
Basic
Extra node
Placement
Arrow
Other elements
Arrow pointing at the center
Trigger mode
Click event
Button with dropdown menu
Custom dropdown
Cascading menu
The way of hiding menu.
Context Menu
Loading
Selectable Menu
Custom semantic dom styling
API
Dropdown
Note
Semantic DOM
Design Token
FAQ
How to prevent Dropdown from being squeezed when it exceeds the screen horizontally?

Dropdown

A dropdown list.
Importimport { Dropdown } from 'antd';
GitHub
components/dropdownIssueOpen issues
Docs
Edit this pageLLMs.md
contributors
    BreadcrumbMenu

    Resources

    Ant Design X
    Ant Design Charts
    Ant Design Pro
    Pro Components
    Ant Design Mobile
    Ant Design Mini
    Ant Design Web3
    Ant Design Landing-Landing Templates
    Scaffolds-Scaffold Market
    Umi-React Application Framework
    dumi-Component doc generator
    qiankun-Micro-Frontends Framework
    Ant Motion-Motion Solution
    China Mirror 🇨🇳

    Community

    Awesome Ant Design
    Medium
    X
    yuque logoAnt Design in YuQue
    Ant Design in Zhihu
    Experience Cloud Blog
    seeconf logoSEE Conf-Experience Tech Conference

    Help

    GitHub
    Change Log
    FAQ
    Bug Report
    Issues
    Discussions
    StackOverflow
    SegmentFault

    Ant XTech logoMore Products

    yuque logoYuQue-Document Collaboration Platform
    AntV logoAntV-Data Visualization
    Egg logoEgg-Enterprise Node.js Framework
    Kitchen logoKitchen-Sketch Toolkit
    Galacean logoGalacean-Interactive Graphics Solution
    WeaveFox logoWeaveFox-AI Development with WeaveFox 🦊
    xtech logoAnt Financial Experience Tech
    Theme Editor
    Made with ❤ by
    Ant Group and Ant Design Community
    loading

    When To Use

    When there are more than a few options to choose from, you can wrap them in a Dropdown. By hovering or clicking on the trigger, a dropdown menu will appear, which allows you to choose an option and execute the relevant action.

    Examples

    API

    Common props ref:Common props

    Dropdown

    PropertyDescriptionTypeDefaultVersion
    arrowWhether the dropdown arrow should be visibleboolean | { pointAtCenter: boolean }false
    autoAdjustOverflowWhether to adjust dropdown placement automatically when dropdown is off screenbooleantrue5.2.0
    classNamesCustomize class for each semantic structure inside the Dropdown component. Supports object or function.Record<SemanticDOM, string> | (info: { props }) => Record<SemanticDOM, string>-
    disabledWhether the dropdown menu is disabledboolean-
    destroyPopupOnHideWhether destroy dropdown when hidden, use destroyOnHidden insteadbooleanfalse
    destroyOnHiddenWhether destroy dropdown when hiddenbooleanfalse5.25.0
    dropdownRenderCustomize dropdown content, use popupRender instead(menus: ReactNode) => ReactNode-4.24.0
    popupRenderCustomize popup content(menus: ReactNode) => ReactNode-5.25.0
    getPopupContainerTo 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
    menuThe menu propsMenuProps-
    overlayClassNameThe class name of the dropdown root element, please use classNames.root insteadstring-
    overlayStyleThe style of the dropdown root element, please use styles.root insteadCSSProperties-
    placementPlacement of popup menu: bottom bottomLeft bottomRight top topLeft topRightstringbottomLeft
    stylesCustomize inline style for each semantic structure inside the Dropdown component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props }) => Record<SemanticDOM, CSSProperties>-
    triggerThe trigger mode which executes the dropdown action. Note that hover can't be used on touchscreensArray<click|hover|contextMenu>[hover]
    openWhether the dropdown menu is currently openboolean-
    onOpenChangeCalled 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

    Note

    Please ensure that the child node of Dropdown accepts onMouseEnter, onMouseLeave, onFocus, onClick events.

    Semantic DOM

    Design Token

    Component TokenHow to use?
    Token NameDescriptionTypeDefault Value
    paddingBlockVertical padding of dropdownPaddingBlock<string | number> | undefined5
    zIndexPopupz-index of dropdownnumber1050
    Global TokenHow to use?
    Token NameDescriptionTypeDefault Value
    colorBgElevatedContainer background color of the popup layer, in dark mode the color value of this token will be a little brighter than `colorBgContainer`. E.g: modal, pop-up, menu, etc.string#ffffff
    colorErrorUsed to represent the visual elements of the operation failure, such as the error Button, error Result component, etc.string#ff4d4f
    colorIconWeak action. Such as `allowClear` or Alert close buttonstringrgba(0,0,0,0.45)
    colorPrimaryBrand color is one of the most direct visual elements to reflect the characteristics and communication of the product. After you have selected the brand color, we will automatically generate a complete color palette and assign it effective design semantics.string#1677ff
    colorPrimaryBorderThe stroke color under the main color gradient, used on the stroke of components such as Slider.string#91caff
    colorSplitUsed as the color of separator, this color is the same as colorBorderSecondary but with transparency.stringrgba(5,5,5,0.06)
    colorTextDefault text color which comply with W3C standards, and this color is also the darkest neutral color.stringrgba(0,0,0,0.88)
    colorTextDescriptionControl the font color of text description.stringrgba(0,0,0,0.45)
    colorTextDisabledControl the color of text in disabled state.stringrgba(0,0,0,0.25)
    colorTextLightSolidControl the highlight color of text with background color, such as the text in Primary Button components.string#fff
    borderRadiusLGLG size border radius, used in some large border radius components, such as Card, Modal and other components.number8
    borderRadiusSMSM size border radius, used in small size components, such as Button, Input, Select and other input components in small sizenumber4
    borderRadiusXSXS size border radius, used in some small border radius components, such as Segmented, Arrow and other components with small border radius.number2
    boxShadowSecondaryControl the secondary box shadow style of an element.string 0 6px 16px 0 rgba(0,0,0,0.08), 0 3px 6px -4px rgba(0,0,0,0.12), 0 9px 28px 8px rgba(0,0,0,0.05)
    controlItemBgActiveControl the background color of control component item when active.string#e6f4ff
    controlItemBgActiveHoverControl the background color of control component item when hovering and active.string#bae0ff
    controlItemBgHoverControl the background color of control component item when hovering.stringrgba(0,0,0,0.04)
    controlPaddingHorizontalControl the horizontal padding of an element.number12
    fontFamilyThe font family of Ant Design prioritizes the default interface font of the system, and provides a set of alternative font libraries that are suitable for screen display to maintain the readability and readability of the font under different platforms and browsers, reflecting the friendly, stable and professional characteristics.string-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'
    fontSizeThe most widely used font size in the design system, from which the text gradient will be derived.number14
    fontSizeIconControl the font size of operation icon in Select, Cascader, etc. Normally same as fontSizeSM.number12
    fontSizeSMSmall font sizenumber12
    lineHeightLine height of text.number1.5714285714285714
    lineWidthFocusControl the width of the line when the component is in focus state.number3
    marginXSControl the margin of an element, with a small size.number8
    marginXXSControl the margin of an element, with the smallest size.number4
    motionDurationMidMotion speed, medium speed. Used for medium element animation interaction.string0.2s
    motionEaseInOutCircPreset motion curve.string
    Cubic Bezier Visualizer
    cubic-bezier(0.78, 0.14, 0.15, 0.86)External Link Icon
    motionEaseInQuintPreset motion curve.string
    Cubic Bezier Visualizer
    cubic-bezier(0.755, 0.05, 0.855, 0.06)External Link Icon
    motionEaseOutCircPreset motion curve.string
    Cubic Bezier Visualizer
    cubic-bezier(0.08, 0.82, 0.17, 1)External Link Icon
    motionEaseOutQuintPreset motion curve.string
    Cubic Bezier Visualizer
    cubic-bezier(0.23, 1, 0.32, 1)External Link Icon
    paddingControl the padding of the element.number16
    paddingXSControl the extra small padding of the element.number8
    paddingXXSControl the extra extra small padding of the element.number4
    sizePopupArrowThe size of the component arrownumber16

    FAQ

    How to prevent Dropdown from being squeezed when it exceeds the screen horizontally?

    You can use width: max-content style to handle this. ref #43025.

    Basic

    The most basic dropdown menu.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Placement

    Support 6 placements.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Other elements

    Divider and disabled menu item.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Trigger mode

    The default trigger mode is hover, you can change it to click.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Button with dropdown menu

    A button is on the left, and a related functional menu is on the right. You can set the icon property to modify the icon of right.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Cascading menu

    The menu has multiple levels.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Context Menu

    The default trigger mode is hover, you can change it to contextMenu. The pop-up menu position will follow the right-click position.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Selectable Menu

    Configure the selectable property in menu to enable selectable ability.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Extra node

    The dropdown menu with shortcut.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    5.21.0
    Arrow

    You could display an arrow.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Arrow pointing at the center

    By specifying arrow prop with { pointAtCenter: true }, the arrow will point to the center of the target element.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Click event

    An event will be triggered when you click menu items, in which you can make different operations according to item's key.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Custom dropdown

    Customize the dropdown menu via popupRender. If you don't need the Menu content, use the Popover component directly.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    The way of hiding menu.

    The default is to close the menu when you click on menu items, this feature can be turned off.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Loading

    A loading indicator can be added to a button by setting the loading property.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Custom semantic dom styling

    You can customize the semantic dom style of the Dropdown by passing objects/functions through classNames and styles.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    6.0.0
    Hover me
    Hover me
    Click me
    Cascading menu
    Right Click on here
    Selectable
    Hover me
    Hover me, Click menu item
    Hover me
    Hover me
    Hover me
    • root
      Root element of dropdown, sets positioning, z-index and container styles
    • itemTitle
      Title content area of dropdown option, sets layout and text styles
    • item
      Individual dropdown option element, sets interaction states and background styles
    • itemContent
      Main content area of dropdown option, sets content layout and link styles
    • itemIcon
      Icon area of dropdown option, sets icon size and spacing styles