Dropdown
Overview
Dropdowns are toggleable, contextual overlays for displaying list of items from which a user can select one item. A selected item can be a link or an action.
When to use:
- Use to hide secondary actions or links in order to reduce distraction.
- Use for a set of actions that don’t fit in the available screen space (including overflow).
- Use when actions’ names are very long or actions require additional description.
Implementation
Dropdowns are toggleable, contextual overlays for displaying lists.
Edit the code below to see your changes live!
Props
Prop name | Type | Default | Description |
|---|---|---|---|
disabled | boolean | false | Disables the toggle. |
maxHeight | number | 250 | Sets the max-height of the dropdown. |
maxWidth | number | | Sets the max-width (in px) of each dropdown item and enables word wrapping. Useful when item content may be long. |
placement | auto | auto-end | auto-start | bottom | bottom-end | bottom-start | left | left-end | left-start | right | right-end | right-start | top | top-end | top-start | bottom-start | Sets the placement of the |
positionFixed | boolean | false | If set, uses |
items * | Array<DropdownItem | DropdownLinkItem> | Array<DropdownItemGroup> | | Accepts an array of |
toggle * | ReactElement | | Element used as anchor. Toggles the |
Props ending with * are required
Do's and Don'ts
Do |
|---|
Anchor the dropdown menu in the least obstructive position on the page. |
Organize dropdown items in alphabetical order or by the most relevant content. |
Use placeholder text by default if no selection has been made. |
Don't |
|---|
Avoid including complex information in a dropdown menu. |
Don’t nest Dropdowns or use them to display complex information. |
Don’t use icons in dropdown items unless they provide additional and necessary context. |