diff --git a/packages/clay-drop-down/src/DropDown.tsx b/packages/clay-drop-down/src/DropDown.tsx index c991f143ab..9df81cfcb8 100644 --- a/packages/clay-drop-down/src/DropDown.tsx +++ b/packages/clay-drop-down/src/DropDown.tsx @@ -4,6 +4,7 @@ */ import {__NOT_PUBLIC_COLLECTION} from '@clayui/core'; +import ClayIcon from '@clayui/icon'; import { FOCUSABLE_ELEMENTS, InternalDispatch, @@ -122,6 +123,11 @@ export interface IProps */ renderMenuOnClick?: boolean; + /** + * Flag indicating if the caret icon should be displayed on the right side. + */ + triggerIcon?: string | null; + /** * Element that is used as the trigger which will activate the dropdown on click. */ @@ -178,6 +184,7 @@ function ClayDropDown({ renderMenuOnClick = false, role = 'menu', trigger, + triggerIcon = 'caret-bottom', ...otherProps }: IProps) { const triggerElementRef = useRef(null); @@ -231,6 +238,18 @@ function ClayDropDown({ 'aria-controls': ariaControls, 'aria-expanded': internalActive, 'aria-haspopup': 'true', + children: + React.isValidElement(trigger) && + // @ts-ignore + trigger?.type.displayName === 'ClayButton' && + triggerIcon ? ( + <> + {trigger.props.children}{' '} + + + ) : ( + trigger.props.children + ), className: classNames( 'dropdown-toggle', trigger.props.className diff --git a/packages/clay-drop-down/src/DropDownWithItems.tsx b/packages/clay-drop-down/src/DropDownWithItems.tsx index 837e20b5eb..21246687f7 100644 --- a/packages/clay-drop-down/src/DropDownWithItems.tsx +++ b/packages/clay-drop-down/src/DropDownWithItems.tsx @@ -184,6 +184,11 @@ export interface IProps * The value that will be passed to the search input element. */ searchValue?: string; + + /** + * Flag indicating if the caret icon should be displayed on the right side. + */ + triggerIcon?: string | null; } const findNested = < @@ -584,6 +589,7 @@ export const ClayDropDownWithItems = ({ searchable, searchProps, searchValue = '', + triggerIcon = null, spritemap, trigger, }: IProps) => { @@ -637,6 +643,7 @@ export const ClayDropDownWithItems = ({ } }, })} + triggerIcon={triggerIcon} > ( } + triggerIcon={null} > {locales.map((locale) => {