mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 19:50:05 +08:00
882cec62d6
* docs: Add components overview page * fix detail * remove ContributorsList form overview page * fix components url * improve code style * remove extra file * fix detail * fix lint * fix lint * docs: Finish components overview page * fix lint * docs: Update cover * fix lint * update cover * update menu * improve overview page * refactor code * fix order * update title * add components count * fix overview page ssr bug * move less file * update title margin Co-authored-by: arvinxx <arvinx@foxmail.com>
3.0 KiB
3.0 KiB
category | type | title | cover |
---|---|---|---|
Components | Navigation | Dropdown | https://gw.alipayobjects.com/zos/alicdn/TIIiKrsQT/Dropdown.svg |
A dropdown list.
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.
API
Dropdown
Property | Description | Type | Default | Version |
---|---|---|---|---|
disabled | Whether the dropdown menu is disabled | boolean | - | |
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. |
Function(triggerNode) | () => document.body |
|
overlay | The dropdown menu | Menu | () => Menu | - | |
overlayClassName | Class name of the dropdown root element | string | - | |
overlayStyle | Style of the dropdown root element | object | - | |
placement | Placement of popup menu: bottomLeft , bottomCenter , bottomRight , topLeft , topCenter or topRight |
String | bottomLeft |
|
trigger | The trigger mode which executes the dropdown action. Note that hover can't be used on touchscreens. | Array<click |hover |contextMenu > |
['hover'] |
|
visible | Whether the dropdown menu is currently visible | boolean | - | |
onVisibleChange | Called when the visible state is changed. | Function(visible) | - |
You should use Menu as overlay
. The menu items and dividers are also available by using Menu.Item
and Menu.Divider
.
Warning: You must set a unique
key
forMenu.Item
.Menu of Dropdown is unselectable by default, you can make it selectable via
<Menu selectable>
.
Dropdown.Button
Property | Description | Type | Default | Version |
---|---|---|---|---|
disabled | Whether the dropdown menu is disabled | boolean | - | |
icon | Icon (appears on the right) | ReactNode | - | |
overlay | The dropdown menu | Menu | - | |
placement | Placement of popup menu: bottomLeft bottomCenter bottomRight topLeft topCenter topRight |
String | bottomLeft |
|
size | Size of the button, the same as Button | string | default |
|
trigger | The trigger mode which executes the dropdown action | Array<click |hover |contextMenu > |
['hover'] |
|
type | Type of the button, the same as Button | string | default |
|
visible | Whether the dropdown menu is currently visible | boolean | - | |
onClick | The same as Button: called when you click the button on the left | Function | - | |
onVisibleChange | Called when the visible state is changed | Function | - | |
buttonsRender | custom buttons inside Dropdown.Button | ([buttons: ReactNode[]]) => ReactNode |
- |