ClayClay
  • Get Started
    • How to Use Clay
    • Composition Philosophy
    • How to Read This Documentation
    • Migrating From v2.x
    • Using Clay in JSPs
  • Components
    • Alert
    • Application Bar
    • Autocomplete
    • Badge
    • Breadcrumb
    • Button Group
    • Buttons
    • Card
    • Chart
    • Color Picker
    • Data Provider
    • Date Picker
    • Drop Down
    • Empty State
    • Form
      • Checkbox
      • Dual List Box
      • Input
      • Radio Group
      • Select
      • Select Box
      • Toggle Switch
    • Forms Hierarchy
    • Icon
    • Label
    • Layout
    • Link
    • List
    • Loading Indicator
    • Localized Input
    • Management Toolbar
    • Modal
    • Multi Select
    • Multi Step Nav
    • Nav
    • Navigation Bar
    • Pagination
    • Pagination Bar
    • Panel
    • Popover
    • Progress Bar
    • Sidebar
    • Slider
    • Sticker
    • Table
    • Tabs
    • Timelines
    • Time Picker
    • Toolbar
    • Tooltip
    • Upper Toolbar
  • Contributing
  • CSS Framework
    • Paver
    • SCSS
    • Color
    • Grid
    • Content
      • Typography
      • C Kbd
    • Utilities
      • Autofit
      • C Focus Inset
      • C Inner
      • C Spacing Utilities
      • Inline Item
    • Playground
  • Examples
  • Docs
  • Blog
  • Storybook
  • Codesandbox
  • Github
  • Use this menu to toggle between Atlas and Base Themes.

Drop Down

yarn add @clayui/drop-down

A dropdown menu displays a list of options for the element that triggers it.

  • Examples
  • Markup
  • API

Stable3.8.4View in LexiconCHANGELOGstorybook demos

  • DropDown
  • DropDown.Action
  • DropDown.Caption
  • DropDown.Divider
  • DropDown.Group
  • DropDown.Help
  • DropDown.Item
  • DropDown.ItemList
  • DropDown.Menu
  • DropDown.Search
  • DropDownWithItems
  • DropDownWithDrilldown

DropDown

PropertyTypeRequiredDefaultDescription
active
booleanfalsefalseFlag to indicate if the DropDown menu is active or not.
alignmentPosition
React.ComponentProps<typeof Menu>['alignmentPosition']falseDefault position of menu element. Values come from `./Menu`.
containerElement
React.JSXElementConstructor<any> | 'div' | 'li'false'div'HTML element tag that the container should render.
hasRightSymbols
booleanfalseFlag to indicate if menu contains icon symbols on the right side.
hasLeftSymbols
booleanfalseFlag to indicate if menu contains icon symbols on the left side.
menuElementAttrs
React.HTMLAttributes<HTMLDivElement>falseProp to pass DOM element attributes to <DropDown.Menu />.
onActiveChange
(val: boolean) => voidtrueCallback for when the active state changes.
offsetFn
React.ComponentProps<typeof Menu>['offsetFn']falseFunction for setting the offset of the menu from the trigger.
trigger
React.ReactElement & { ref?: (node: HTMLButtonElement | null) => void; }trueElement that is used as the trigger which will activate the dropdown on click.

DropDown.Action

Extends from React.HTMLAttributes<HTMLButtonElement>

DropDown.Caption

Extends from React.HTMLAttributes<HTMLDivElement>

DropDown.Divider

Extends from React.HTMLAttributes<HTMLLIElement>

DropDown.Group

PropertyTypeRequiredDefaultDescription
header
stringfalseValue provided is a display component that is a header for the items in the group.

DropDown.Help

Extends from React.HTMLAttributes<HTMLDivElement>

DropDown.Item

PropertyTypeRequiredDefaultDescription
active
booleanfalseFlag that indicates if item is selected.
disabled
booleanfalseFlag that indicates if item is disabled or not.
href
stringfalsePath for item to link to.
innerRef
React.Ref<any>false
spritemap
stringfalsePath to icon spritemap from clay-css.
symbolLeft
stringfalseFlag that indicates if there is an icon symbol on the left side.
symbolRight
stringfalseFlag that indicates if there is an icon symbol on the right side.

DropDown.ItemList

Extends from React.HTMLAttributes<HTMLUListElement>

DropDown.Menu

PropertyTypeRequiredDefaultDescription
active
booleanfalseFlag to indicate if menu is showing or not.
alignElementRef
React.RefObject<HTMLElement>trueHTML element that the menu should be aligned to
autoBestAlign
booleanfalsetrueFlag to suggest or not the best region to align menu element.
alignmentPosition
number | TPointOptionsfalse5Default position of menu element. Values come from above. Align.TopCenter = 0; Align.TopRight = 1; Align.RightCenter = 2; Align.BottomRight = 3; Align.BottomCenter = 4; Align.BottomLeft = 5; Align.LeftCenter = 6; Align.TopLeft = 7; Defaults to BottomLeft You can also pass an array of strings, corresponding to the points of the targetNode and sourceNode, `[sourceNode, targetNode]`. Points can be 't'(top), 'b'(bottom), 'c'(center), 'l'(left), 'r'(right). For example: `['tl', 'bl']` corresponds to the bottom left alignment.
hasLeftSymbols
booleanfalseFlag to indicate if menu is displaying a clay-icon on the left.
hasRightSymbols
booleanfalseFlag to indicate if menu is displaying a clay-icon on the right.
focusRefOnEsc
React.RefObject<HTMLElement>falseElement ref to call focus() on after menu is closed via Escape key
offsetFn
(points: TPointOptions) => [number, number]false(points) => OFFSET_MAP[points.join('') as keyof typeof OFFSET_MAP] as [ number, number ]Function for setting the offset of the menu from the trigger.
onSetActive
(val: boolean) => voidtrueCallback function for when active state changes.

DropDown.Search

PropertyTypeRequiredDefaultDescription
formProps
React.HTMLAttributes<HTMLFormElement>false{}Props to add to form element
onChange
(event: React.ChangeEvent<HTMLInputElement>) => voidtrueCallback for when input value changes.
spritemap
stringfalsePath to the location of the spritemap resource.
value
React.ReactTexttrueValue of the searchInput

DropDownWithItems

PropertyTypeRequiredDefaultDescription
spritemap
stringfalseThe path to the SVG spritemap file containing the icons.
items
Array<IItem>trueList of items to display in drop down menu
alignmentPosition
React.ComponentProps< typeof ClayMenu >['alignmentPosition']falseDefault position of menu element. Values come from `./Menu`.
caption
stringfalseInformational text that appears at the end or above the `footerContent` prop.
className
stringfalse
containerElement
React.ComponentProps< typeof ClayDropDown >['containerElement']falseHTML element tag that the container should render.
footerContent
React.ReactElementfalseAdd an action button or any other element you want to be fixed position to the footer from the DropDown.
trigger
React.ReactElementtrueElement that is used as the trigger which will activate the dropdown on click.
helpText
stringfalseAdd informational text at the top of DropDown.
menuElementAttrs
React.ComponentProps< typeof ClayDropDown >['menuElementAttrs']falseProp to pass DOM element attributes to <DropDown.Menu />.
offsetFn
React.ComponentProps<typeof ClayDropDown>['offsetFn']falseFunction for setting the offset of the menu from the trigger.
onSearchValueChange
(newValue: string) => voidfalse() => {}Callback will always be called when the user is interacting with search.
searchable
booleanfalseFlag to show search at the top of the DropDown.
searchProps
Omit< React.ComponentProps<typeof Search>, 'onChange' | 'spritemap' | 'value' >falsePass the props to the Search component.
searchValue
stringfalse''The value that will be passed to the search input element.

DropDownWithDrilldown

PropertyTypeRequiredDefaultDescription
alignmentPosition
React.ComponentProps< typeof ClayMenu >['alignmentPosition']falseDefault position of menu element. Values come from `./Menu`.
containerElement
React.ComponentProps< typeof ClayDropDown >['containerElement']falseHTML element tag that the container should render.
initialActiveMenu
stringtrueThe unique identifier of the menu that should be active on mount.
menuElementAttrs
React.ComponentProps< typeof ClayDropDown >['menuElementAttrs']falseProp to pass DOM element attributes to <DropDown.Menu />.
menus
{ [id: string]: React.ComponentProps<typeof Drilldown.Menu>['items']; }trueMap of menus and items to be used in the drilldown. Each key should be a unique identifier for the menu.
offsetFn
React.ComponentProps<typeof ClayDropDown>['offsetFn']falseFunction for setting the offset of the menu from the trigger.
spritemap
stringfalsePath to spritemap
trigger
React.ReactElementtrueElement that is used as the trigger which will activate the dropdown on click.

How can this be improved? Create an issue!