Dropdown

Examples

Dropdown

Copied to clipboard

Dropdown - position right

Copied to clipboard

Dropdown - direction up

Copied to clipboard

Kebab

Copied to clipboard

React Router Link usage

A react-router Link may be wrapped by DropdownItem or used directly within Dropdown.

  /** Wrapped Link for DropdownItem list **/
  <DropdownItem key="link">
    <Link to={'/'}>Link</Link>
  </DropdownItem>

  /** Direct child of Dropdown **/
  <Dropdown
    onSelect={this.onSelect}
    toggle={
      <DropdownToggle onToggle={this.onToggle}>
        Expanded Dropdown
      </DropdownToggle>
    }
    isOpen={isOpen}
  >
    <Link to={'/'}>Link</Link>
  </Dropdown>
        
Copied to clipboard

Dropdown Panel

The Basic Dropdown is provided for flexibility in allowing various content within a dropdown.

Copied to clipboard

Dropdown Props

The Dropdown component accepts the following props.

NameTypeRequiredDefaultDescription
children
custom
nullAnything which can be rendered in a dropdown
className
string
''Classes applied to root element of dropdown
dropdownItems
array
[]Array of DropdownItem nodes that will be rendered in the dropdown Menu list
isOpen
bool
falseFlag to indicate if menu is opened
isPlain
bool
falseDisplay the toggle with no border or background
position
enum
DropdownPosition.leftIndicates where menu will be alligned horizontally
direction
enum
DropdownDirection.downDisplay menu above or below dropdown toggle
toggle
node
Placeholder to use custom toggle elements
onSelect
func
Function.prototypeFunction callback called when user selects item

KebabToggle Props

The KebabToggle component accepts the following props.

NameTypeRequiredDefaultDescription
id
string
''HTML ID of dropdown toggle
children
node
nullAnything which can be rendered as dropdown toggle
className
string
''Classess applied to root element of dropdown toggle
isOpen
bool
falseFlag to indicate if menu is opened
aria-label
string
'Actions'Label Toggle button
onToggle
func
Function.prototypeCallback called when toggle is clicked
parentRef
any
nullElement which wraps toggle
isFocused
bool
falseForces focus state
isHovered
bool
falseForces hover state
isActive
bool
falseForces active state
isPlain
bool
falseDisplay the toggle with no border or background

DropdownItem Props

The DropdownItem component accepts the following props.

NameTypeRequiredDefaultDescription
children
node
nullAnything which can be rendered as dropdown item
className
string
''Classess applied to root element of dropdown item
component
custom
'a'Indicates which component will be used as dropdown item
isDisabled
bool
falseRender dropdown item as disabled option
isHovered
bool
falseForces display of the hover state of the element
href
string
'#'Default hyperlink location

DropdownSeparator Props

The DropdownSeparator component accepts the following props.

NameTypeRequiredDefaultDescription
children
node
nullAnything which can be rendered as dropdown item
className
string
''Classes applied to root element of dropdown item
component
custom
'a'Indicates which component will be used as dropdown item
isDisabled
bool
falseRender dropdown item as disabled option
isHovered
bool
falseForces display of the hover state of the element
href
string
'#'Default hyperlink location

DropdownToggle Props

The DropdownToggle component accepts the following props.

NameTypeRequiredDefaultDescription
id
string
''HTML ID of dropdown toggle
children
node
Anything which can be rendered as dropdown toggle
className
string
''Classes applied to root element of dropdown toggle
isOpen
bool
falseFlag to indicate if menu is opened
onToggle
func
Function.prototypeCallback called when toggle is clicked
parentRef
any
nullElement which wraps toggle
isFocused
bool
falseForces focus state
isHovered
bool
falseForces hover state
isActive
bool
falseForces active state
isPlain
bool
falseDisplay the toggle with no border or background
iconComponent
func
CaretDownIconThe icon to display for the toggle. Defaults to CaretDownIcon. Set to null to not show an icon.