diff --git a/packages/react-core/src/components/Dropdown/Dropdown.tsx b/packages/react-core/src/components/Dropdown/Dropdown.tsx index a35ad8b4b4d..770f377a5b5 100644 --- a/packages/react-core/src/components/Dropdown/Dropdown.tsx +++ b/packages/react-core/src/components/Dropdown/Dropdown.tsx @@ -65,6 +65,10 @@ export interface DropdownProps extends MenuProps, OUIAProps { zIndex?: number; /** Additional properties to pass to the Popper */ popperProps?: DropdownPopperProps; + /** Height of the dropdown menu */ + menuHeight?: string; + /** Maximum height of dropdown menu */ + maxMenuHeight?: string; } const DropdownBase: React.FunctionComponent = ({ @@ -83,6 +87,8 @@ const DropdownBase: React.FunctionComponent = ({ zIndex = 9999, popperProps, onOpenChangeKeys = ['Escape', 'Tab'], + menuHeight, + maxMenuHeight, ...props }: DropdownProps) => { const localMenuRef = React.useRef(); @@ -138,6 +144,8 @@ const DropdownBase: React.FunctionComponent = ({ }; }, [isOpen, menuRef, toggleRef, onOpenChange, onOpenChangeKeys]); + const scrollable = maxMenuHeight !== undefined || menuHeight !== undefined || isScrollable; + const menu = ( = ({ shouldFocusToggleOnSelect && toggleRef.current.focus(); }} isPlain={isPlain} - isScrollable={isScrollable} + isScrollable={scrollable} {...props} {...ouiaProps} > - {children} + + {children} + ); return (