A dropdown displays a list of two or more options when clicked.

Example

⌘ Cmd + ⌥ Option + 1

Buttons can also open dropdowns. Unlike momentary buttons, these buttons stay in their ‘pressed’ state until the dropdown menu disappears.

Buttons that open dropdowns must have a chevron visible. This chevron, or downward facing arrow, must be the same color as the button text.

Properties

"BlockList.Item" Component
propertypropTyperequireddefaultdescription
guttersoneOf 'loose' | 'tight'-'loose'Determines level of padding of item
childrennodeyes-String or JSX that appears within the component
hrefstring--URL to navigate to when clicking on the item
hrefTargetoneOf '_self' | '_blank'--Target that the link, if provided, should open in
hrefTitlestring--Sets the `title` attribute on an `href`
isDisabledbool--Disable the item
onClickfunc--Function that is run when clicking on the item
onMouseDownfunc--Function that is run when mouse-down event is fired on the item
testSectionstring--Hook for automated JavaScript tests
"BlockList.Category" Component
propertypropTyperequireddefaultdescription
childrennodeyes-Items that appears within the category
headernode--Node or component that appears above the `children`
testSectionstring--Hook for automated JavaScript tests
"BlockList" Component
propertypropTyperequireddefaultdescription
hasBorderbool-trueShould the `BlockList` contain a border on all sides
childrennodeyes-Should be subcomponents of `BlockList`
maxHeightnumber | string-- The max height of the `BlockList`. Pixels will be assumed if no unit is
provided.
testSectionstring--Hook for automated JavaScript tests
"Dropdown" Component
propertypropTyperequireddefaultdescription
arrowIcononeOf 'down' | 'left' | 'none' | 'right' | 'up'-'none' Arrow icon direction:
- Defaults to 'none', which hides the arrow

- passing a prop value of false also hides the arrow

- passing a prop value of true uses down arrow
activatornode-- React element that when clicked activates the dropdown
Either this prop OR buttonContent should be used, not both
buttonContentstring | element-- Button text, can be a string or element.
Either this prop OR activator should be used, not both
childrennodeyes-Dropdown contents, typically using the <Blocklist> component.
displayErrorbool--Show error state.
fullWidthbool--Button width is either full or inline-block.
handleClickfunc--Unused...
hidefunc--
isDisabledbool--Disable button.
isOpenbool--
overChildrenbool--
placementoneOf 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'right' | 'right-start' | 'right-end' | 'left' | 'left-start' | 'left-end'--Popper placement property
setOverChildrenbool--
stylestring--Button style, e.g. highlight, danger, outline.
testSectionstring--For automated testing only.
togglefunc--Toggle control for isOpen.
widthstring | number--Dropdown menu width, in pixels.
zIndexnumber--Override default dropdown menu z-index.

Usage

We use the Dropdown component in two ways throughout our application:

As a select list

Typically we use Dropdown instead of <select>, because it allows for complex content like multi-line descriptions, icons, and headers.

As a menu

In rare and specific cases like the main dashboard, Dropdown is used as a menu where clicking list items launches a create-new-experiment sheet.

Best Practices

Do

Use Dropdown when content is too complex for <select>

Keep inner Dropdown contents simple and uncomplicated

Don't

Allow horizontal scrolling in a Dropdown menu