React Dropdown Component API
Dropdown API
Limited-time offer for the first 100 customers in 2025. Use code 2025SKY25 at checkout.
Explore the API reference for the React Dropdown component and discover how to effectively utilize its props for customization.
CDropdown#
import { CDropdown } from '@coreui/react'// orimport CDropdown from '@coreui/react/src/components/dropdown/CDropdown'
Property | Default | Type |
---|---|---|
alignment# | - | 'start' , 'end' , { xs: 'start' | 'end' } , { sm: 'start' | 'end' } , { md: 'start' | 'end' } , { lg: 'start' | 'end' } , { xl: 'start' | 'end'} , { xxl: 'start' | 'end'} |
Specifies the alignment of the React Dropdown Menu within this React Dropdown.
| ||
as# | div | (ElementType & 'symbol') , (ElementType & 'object') , (ElementType & 'div') , (ElementType & 'slot') , (ElementType & 'style') , ... 174 more ... , (ElementType & FunctionComponent<...>) |
Determines the root node component (native HTML element or a custom React component) for the React Dropdown. | ||
autoClose# | true | boolean , 'inside' , 'outside' |
Configures automatic closing behavior for the React Dropdown:
| ||
className# | - | string |
Adds custom classes to the React Dropdown root element. | ||
container#4.11.0+ | - | Element , DocumentFragment , (() => Element | DocumentFragment) |
Appends the React Dropdown Menu to a specific element. You can pass an HTML element or a function returning an element. Defaults to
| ||
dark# | - | boolean |
Applies a darker color scheme to the React Dropdown Menu, often used within dark navbars. | ||
direction# | - | 'center' , 'dropup' , 'dropup-center' , 'dropend' , 'dropstart' |
Specifies the direction of the React Dropdown. | ||
offset# | [0, 2] | [number, number] |
Defines x and y offsets ([x, y]) for the React Dropdown Menu relative to its target.
| ||
onHide#4.9.0+ | - | () => void |
Callback fired right before the React Dropdown becomes hidden. | ||
onShow# | - | () => void |
Callback fired immediately after the React Dropdown is displayed. | ||
placement# | bottom-start | 'auto' , 'auto-start' , 'auto-end' , 'top-end' , 'top' , 'top-start' , 'bottom-end' , 'bottom' , 'bottom-start' , 'right-start' , 'right' , 'right-end' , 'left-start' , 'left' , 'left-end' |
Determines the placement of the React Dropdown Menu after Popper.js modifiers. | ||
popper# | true | boolean |
Enables or disables dynamic positioning via Popper.js for the React Dropdown Menu. | ||
popperConfig#5.5.0+ | - | Partial<Options> , ((defaultPopperConfig: Partial<Options>) => Partial<Options>) |
Provides a custom Popper.js configuration or a function that returns a modified Popper.js configuration for advanced positioning of the React Dropdown Menu. Read more
| ||
portal#4.8.0+ | false | boolean |
Renders the React Dropdown Menu using a React Portal, allowing it to escape the DOM hierarchy for improved positioning. | ||
variant# | btn-group | 'btn-group' , 'dropdown' , 'input-group' , 'nav-item' |
Defines the visual variant of the React Dropdown | ||
visible# | false | boolean |
Controls the visibility of the React Dropdown Menu:
|
CDropdownDivider#
import { CDropdownDivider } from '@coreui/react'// orimport CDropdownDivider from '@coreui/react/src/components/dropdown/CDropdownDivider'
Property | Default | Type |
---|---|---|
className# | - | string |
A string of all className you want applied to the component. |
CDropdownHeader#
import { CDropdownHeader } from '@coreui/react'// orimport CDropdownHeader from '@coreui/react/src/components/dropdown/CDropdownHeader'
Property | Default | Type |
---|---|---|
as# | - | (ElementType & 'symbol') , (ElementType & 'object') , (ElementType & 'h6') , (ElementType & 'slot') , (ElementType & 'style') , ... 174 more ... , (ElementType & FunctionComponent<...>) |
Component used for the root node. Either a string to use a HTML element or a component. | ||
className# | - | string |
A string of all className you want applied to the component. |
CDropdownItem#
import { CDropdownItem } from '@coreui/react'// orimport CDropdownItem from '@coreui/react/src/components/dropdown/CDropdownItem'
Property | Default | Type |
---|---|---|
active# | - | boolean |
Toggle the active state for the component. | ||
as# | a | (ElementType & 'symbol') , (ElementType & 'object') , (ElementType & 'a') , (ElementType & 'cite') , (ElementType & 'data') , ... 174 more ... , (ElementType & FunctionComponent<...>) |
Component used for the root node. Either a string to use a HTML element or a component. | ||
className# | - | string |
A string of all className you want applied to the component. | ||
disabled# | - | boolean |
Toggle the disabled state for the component. | ||
href# | - | string |
The href attribute specifies the URL of the page the link goes to. |
CDropdownItemPlain#
import { CDropdownItemPlain } from '@coreui/react'// orimport CDropdownItemPlain from '@coreui/react/src/components/dropdown/CDropdownItemPlain'
Property | Default | Type |
---|---|---|
as# | - | (ElementType & 'symbol') , (ElementType & 'object') , (ElementType & 'span') , (ElementType & 'slot') , (ElementType & 'style') , ... 174 more ... , (ElementType & FunctionComponent<...>) |
Component used for the root node. Either a string to use a HTML element or a component. | ||
className# | - | string |
A string of all className you want applied to the component. |
CDropdownMenu#
import { CDropdownMenu } from '@coreui/react'// orimport CDropdownMenu from '@coreui/react/src/components/dropdown/CDropdownMenu'
Property | Default | Type |
---|---|---|
as# | - | (ElementType & 'symbol') , (ElementType & 'object') , (ElementType & 'ul') , (ElementType & 'slot') , (ElementType & 'style') , ... 174 more ... , (ElementType & FunctionComponent<...>) |
Component used for the root node. Either a string to use a HTML element or a component. | ||
className# | - | string |
A string of all className you want applied to the base component. |
CDropdownToggle#
import { CDropdownToggle } from '@coreui/react'// orimport CDropdownToggle from '@coreui/react/src/components/dropdown/CDropdownToggle'
Property | Default | Type |
---|---|---|
active# | - | boolean |
Toggle the active state for the component. | ||
as# | - | ElementType |
Component used for the root node. Either a string to use a HTML element or a component. | ||
caret# | true | boolean |
Enables pseudo element caret on toggler. | ||
className# | - | string |
A string of all className you want applied to the base component. | ||
color# | - | 'primary' , 'secondary' , 'success' , 'danger' , 'warning' , 'info' , 'dark' , 'light' , string |
Sets the color context of the component to one of CoreUI’s themed colors. | ||
custom# | - | boolean |
Create a custom toggler which accepts any content. | ||
disabled# | - | boolean |
Toggle the disabled state for the component. | ||
href# | - | string |
The href attribute specifies the URL of the page the link goes to. | ||
navLink#5.0.0+ | true | boolean |
If a dropdown | ||
role# | - | string |
The role attribute describes the role of an element in programs that can make use of it, such as screen readers or magnifiers. | ||
shape# | - | 'rounded' , 'rounded-top' , 'rounded-end' , 'rounded-bottom' , 'rounded-start' , 'rounded-circle' , 'rounded-pill' , 'rounded-0' , 'rounded-1' , 'rounded-2' , 'rounded-3' , string |
Select the shape of the component. | ||
size# | - | 'sm' , 'lg' |
Size the component small or large. | ||
split# | - | boolean |
Similarly, create split button dropdowns with virtually the same markup as single button dropdowns, but with the addition of | ||
trigger# | click | 'hover' , 'focus' , 'click' |
Sets which event handlers you’d like provided to your toggle prop. You can specify one trigger or an array of them. | ||
variant# | - | 'outline' , 'ghost' |
Set the button variant to an outlined button or a ghost button. |