Dropdowns
React Bootstrap 5 Dropdowns component
Toggle contextual overlays for displaying lists of links and more with the MDB dropdown plugin.
Note: Read the API tab to find all available options and advanced customization
Basic examples
Wrap the dropdown’s toggle (your button or link) and the dropdown menu within
.dropdown
, or another element that declares position: relative;
.
Dropdowns can be triggered from <a>
or <button>
elements
to better fit your potential needs. The examples shown here use semantic
<ul>
elements where appropriate, but custom markup is supported.
Colors
You can do this with any button variant:
import React from 'react';
import { MDBDropdown, MDBDropdownMenu, MDBDropdownToggle, MDBDropdownItem, MDBDropdownLink } from 'mdb-react-ui-kit';
export default function App() {
return (
<>
<MDBDropdown group>
<MDBDropdownToggle color='primary'>Action</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem>
<MDBDropdownLink href="#">Action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Another action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Something else here</MDBDropdownLink>
</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<MDBDropdown group>
<MDBDropdownToggle color='success'>Action</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem>
<MDBDropdownLink href="#">Action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Another action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Something else here</MDBDropdownLink>
</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<MDBDropdown group>
<MDBDropdownToggle color='warning'>Action</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem>
<MDBDropdownLink href="#">Action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Another action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Something else here</MDBDropdownLink>
</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<MDBDropdown group>
<MDBDropdownToggle color='info'>Action</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem>
<MDBDropdownLink href="#">Action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Another action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Something else here</MDBDropdownLink>
</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<MDBDropdown group>
<MDBDropdownToggle color='danger'>Action</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem>
<MDBDropdownLink href="#">Action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Another action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Something else here</MDBDropdownLink>
</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<MDBDropdown group>
<MDBDropdownToggle color='dark'>Action</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem>
<MDBDropdownLink href="#">Action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Another action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Something else here</MDBDropdownLink>
</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<MDBDropdown group className='shadow-0'>
<MDBDropdownToggle color='light'>Action</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem>
<MDBDropdownLink href="#">Action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Another action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Something else here</MDBDropdownLink>
</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<MDBDropdown group className='shadow-0'>
<MDBDropdownToggle color='link'>Action</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem>
<MDBDropdownLink href="#">Action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Another action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Something else here</MDBDropdownLink>
</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
</>
);
}
Sizing
Button dropdowns work with buttons of all sizes, including default and split dropdown buttons.
import React from 'react';
import { MDBDropdown, MDBDropdownMenu, MDBDropdownToggle, MDBDropdownItem, MDBDropdownLink, MDBBtn } from 'mdb-react-ui-kit';
export default function App() {
return (
<>
<MDBDropdown group>
<MDBDropdownToggle size='lg'>Large button</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem>
<MDBDropdownLink href="#">Action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Another action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Something else here</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<hr className='dropdown-divider' />
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Separated link</MDBDropdownLink>
</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<MDBDropdown group>
<MDBBtn size='lg'> Large split button</MDBBtn>
<MDBDropdownToggle size='lg' split />
<MDBDropdownMenu>
<MDBDropdownItem>
<MDBDropdownLink href="#">Action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Another action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Something else here</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<hr className='dropdown-divider' />
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Separated link</MDBDropdownLink>
</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<MDBDropdown group>
<MDBDropdownToggle size='sm'>Small button</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem>
<MDBDropdownLink href="#">Action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Another action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Something else here</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<hr className='dropdown-divider' />
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Separated link</MDBDropdownLink>
</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<MDBDropdown group>
<MDBBtn size='sm'> Small split button</MDBBtn>
<MDBDropdownToggle size='sm' split />
<MDBDropdownMenu>
<MDBDropdownItem>
<MDBDropdownLink href="#">Action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Another action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Something else here</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<hr className='dropdown-divider' />
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Separated link</MDBDropdownLink>
</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
</>
);
}
Directions
Dropup
Trigger dropdown menus above elements by adding .dropup
to the parent element.
import React from 'react';
import {
MDBDropdown,
MDBDropdownMenu,
MDBDropdownToggle,
MDBDropdownItem,
MDBDropdownLink,
MDBBtn
} from 'mdb-react-ui-kit';
export default function App() {
return (
<>
<MDBDropdown dropup group>
<MDBDropdownToggle>Dropup</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem>
<MDBDropdownLink href="#">Action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Another action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Something else here</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<hr className='dropdown-divider' />
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Separated link</MDBDropdownLink>
</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<MDBDropdown dropup group>
<MDBBtn>Split Dropup</MDBBtn>
<MDBDropdownToggle />
<MDBDropdownMenu>
<MDBDropdownItem>
<MDBDropdownLink href="#">Action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Another action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Something else here</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<hr className='dropdown-divider' />
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Separated link</MDBDropdownLink>
</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
</>
);
}
Dropright
Trigger dropdown menus at the right of the elements by adding
.dropend
to the parent element.
import React from 'react';
import {
MDBDropdown,
MDBDropdownMenu,
MDBDropdownToggle,
MDBDropdownItem,
MDBDropdownLink,
MDBBtn
} from 'mdb-react-ui-kit';
export default function App() {
return (
<>
<MDBDropdown dropright group>
<MDBDropdownToggle>Dropright</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem>
<MDBDropdownLink href="#">Action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Another action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Something else here</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<hr className='dropdown-divider' />
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Separated link</MDBDropdownLink>
</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<MDBDropdown dropright group>
<MDBBtn>Split Dropright</MDBBtn>
<MDBDropdownToggle />
<MDBDropdownMenu>
<MDBDropdownItem>
<MDBDropdownLink href="#">Action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Another action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Something else here</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<hr className='dropdown-divider' />
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Separated link</MDBDropdownLink>
</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
</>
);
}
Dropleft
Trigger dropdown menus at the left of the elements by adding
.dropstart
to the parent element.
import React from 'react';
import {
MDBDropdown,
MDBDropdownMenu,
MDBDropdownToggle,
MDBDropdownItem,
MDBDropdownLink,
MDBBtn
} from 'mdb-react-ui-kit';
export default function App() {
return (
<>
<MDBDropdown dropleft group>
<MDBDropdownToggle>Dropleft</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem>
<MDBDropdownLink href="#">Action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Another action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Something else here</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<hr className='dropdown-divider' />
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Separated link</MDBDropdownLink>
</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<MDBDropdown dropleft group>
<MDBBtn>Split Dropleft</MDBBtn>
<MDBDropdownToggle />
<MDBDropdownMenu>
<MDBDropdownItem>
<MDBDropdownLink href="#">Action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Another action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Something else here</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<hr className='dropdown-divider' />
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Separated link</MDBDropdownLink>
</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
</>
);
}
Remove animation
To remove the fade animation on click, add
data-mdb-dropdown-animation="off"
attribute to the dropdown button.
import React from 'react';
import { MDBDropdown, MDBDropdownMenu, MDBDropdownToggle, MDBDropdownItem, MDBDropdownLink } from 'mdb-react-ui-kit';
export default function App() {
return (
<MDBDropdown animation={false}>
<MDBDropdownToggle>Dropdown button</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem>
<MDBDropdownLink href="#">Action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Another action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Something else here</MDBDropdownLink>
</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
);
}
Dropdown options
Use options
prop to change options in dropdown.
import React from 'react';
import { MDBDropdown, MDBDropdownMenu, MDBDropdownToggle, MDBDropdownItem, MDBDropdownLink } from 'mdb-react-ui-kit';
export default function App() {
return (
<>
<MDBDropdown options={{
modifiers:[
{
name: 'offset',
options: {
offset: [10, 20],
},
},
]}}>
<MDBDropdownToggle>Dropdown button</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem>
<MDBDropdownLink href="#">Action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Another action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Something else here</MDBDropdownLink>
</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
</>
);
}
Dark variant
Add .dropdown-menu-dark
onto an existing .dropdown-menu
to match a
dark navbar.
import React from 'react';
import { MDBDropdown, MDBDropdownMenu, MDBDropdownToggle, MDBDropdownItem, MDBDropdownLink } from 'mdb-react-ui-kit';
export default function App() {
return (
<MDBDropdown>
<MDBDropdownToggle color='secondary'>Dropdown button</MDBDropdownToggle>
<MDBDropdownMenu dark>
<MDBDropdownItem>
<MDBDropdownLink href="#">Action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Another action</MDBDropdownLink>
</MDBDropdownItem>
<MDBDropdownItem>
<MDBDropdownLink href="#">Something else here</MDBDropdownLink>
</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
);
}
Dropdowns - API
Import
import {
MDBDropdown,
MDBDropdownLink,
MDBDropdownMenu,
MDBDropdownToggle,
MDBDropdownItem,
MDBDropdownHeader,
MDBDropdownDivider
} from 'mdb-react-ui-kit';
Properties
MDBDropdown
Name | Type | Default | Description | Example |
---|---|---|---|---|
className
|
String | '' |
Add custom class to MDBDropdown |
<MDBDropdown className="class" />
|
tag
|
String | 'span' |
Defines tag of the MDBDropdown element |
<MDBDropdown tag="section" />
|
group
|
Boolean | false |
Set class group to MDBDropdown element |
<MDBDropdown group />
|
isOpen
|
Boolean | false |
Set open dropdown on mounted in MDBDropdown element
|
<MDBDropdown isOpen />
|
dropup
|
Boolean | false |
Set placement with this prop to MDBDropdown element
|
<MDBDropdown dropup />
|
dropright
|
Boolean | false |
Set placement with this prop to MDBDropdown element
|
<MDBDropdown dropright />
|
dropleft
|
Boolean | false |
Set placement with this prop to MDBDropdown element
|
<MDBDropdown dropleft />
|
options
|
Object | {} |
Set default options to MDBDropdown element |
<MDBDropdown options={{...}} />
|
animation
|
Boolean | true |
Turn off/on animation to MDBDropdown element |
<MDBDropdown animation />
|
MDBDropdownToggle
Name | Type | Default | Description | Example |
---|---|---|---|---|
className
|
String | '' |
Add custom class to MDBDropdownToggle |
<MDBDropdownToggle className="class" />
|
tag
|
String | 'span' |
Defines tag of the MDBDropdownToggle element |
<MDBDropdownToggle tag="section" />
|
split
|
Boolean | false |
Set split to MDBDropdownToggle element if you add
more buttons to split
|
<MDBDropdownToggle tag="section" />
|
MDBDropdownLink
Name | Type | Default | Description | Example |
---|---|---|---|---|
className
|
String | '' |
Add custom class to MDBDropdownLink |
<MDBDropdownLink className="class" />
|
tag
|
String | 'a' |
Defines tag of the MDBDropdownLink element |
<MDBDropdownLink tag="section" />
|
MDBDropdownItem
Name | Type | Default | Description | Example |
---|---|---|---|---|
className
|
String | '' |
Add custom class to MDBDropdownItem |
<MDBDropdownItem className="class" />
|
tag
|
String | 'li' |
Defines tag of the MDBDropdownItem element |
<MDBDropdownItem tag="section" />
|
MDBDropdownHeader
Name | Type | Default | Description | Example |
---|---|---|---|---|
className
|
String | '' |
Add custom class to MDBDropdownHeader |
<MDBDropdownHeader className="class" />
|
tag
|
String | 'h6' |
Defines tag of the MDBDropdownHeader element |
<MDBDropdownHeader tag="section" />
|
MDBDropdownDivider
Name | Type | Default | Description | Example |
---|---|---|---|---|
className
|
String | '' |
Add custom class to MDBDropdownDivider |
<MDBDropdownDivider className="class" />
|
tag
|
String | 'div' |
Defines tag of the MDBDropdownDivider element
|
<MDBDropdownDivider tag="section" />
|