import React from 'react' import { CButton, CButtonGroup, CCard, CCardBody, CCardHeader, CCol, CDropdown, CDropdownDivider, CDropdownItem, CDropdownMenu, CDropdownToggle, CRow, } from '@coreui/react' import { DocsCallout, DocsExample } from 'src/components' const Dropdowns = () => { return ( React Dropdown Single button

Here's how you can put them to work with either <button>{' '} elements:

Dropdown button Action Another action Something else here

The best part is you can do this with any button variant, too:

<> {['primary', 'secondary', 'success', 'info', 'warning', 'danger'].map( (color, index) => ( {color} Action Another action Something else here Separated link ), )}
React Dropdown Split button

Similarly, create split button dropdowns with virtually the same markup as single button dropdowns, but with the addition of boolean prop split for proper spacing around the dropdown caret.

We use this extra class to reduce the horizontal padding on either side of the caret by 25% and remove the margin-left that's attached for normal button dropdowns. Those additional changes hold the caret centered in the split button and implement a more properly sized hit area next to the main button.

<> {['primary', 'secondary', 'success', 'info', 'warning', 'danger'].map( (color, index) => ( {color} Action Another action Something else here Separated link ), )}
React Dropdown Sizing

Button dropdowns work with buttons of all sizes, including default and split dropdown buttons.

Large button Action Another action Something else here Separated link Large split button Action Another action Something else here Separated link Small button Action Another action Something else here Separated link Small split button Action Another action Something else here Separated link
React Dropdown Single button

Opt into darker dropdowns to match a dark navbar or custom style by set{' '} dark property. No changes are required to the dropdown items.

Dropdown button Action Another action Something else here Separated link

And putting it to use in a navbar:

React Dropdown Dropup

Trigger dropdown menus above elements by adding{' '} direction="dropup" to the <CDropdown>{' '} component.

Dropdown Action Another action Something else here Separated link Small split button Action Another action Something else here Separated link
React Dropdown Dropright

Trigger dropdown menus at the right of the elements by adding{' '} direction="dropend" to the <CDropdown>{' '} component.

Dropdown Action Another action Something else here Separated link Small split button Action Another action Something else here Separated link
React Dropdown Dropleft

Trigger dropdown menus at the left of the elements by adding{' '} direction="dropstart" to the <CDropdown>{' '} component.

Action Another action Something else here Separated link Small split button
) } export default Dropdowns