@@ -21,7 +21,7 @@ export interface AttachMenuProps extends DropdownProps {
2121 /** Items in menu */
2222 filteredItems : React . ReactNode ;
2323 /** A callback for when the input value changes. */
24- handleTextInputChange : ( value : string ) => void ;
24+ handleTextInputChange ? : ( value : string ) => void ;
2525 /** Flag to indicate if menu is opened. */
2626 isOpen : boolean ;
2727 /** Additional properties to pass to the Popper */
@@ -44,6 +44,8 @@ export interface AttachMenuProps extends DropdownProps {
4444 menuSearchInputProps ?: Omit < MenuSearchInputProps , 'ref' > ;
4545 /** Additional props passed to SearchInput component */
4646 searchInputProps ?: SearchInputProps ;
47+ /** Whether menu has search input */
48+ hasSearchInput ?: boolean ;
4749}
4850
4951export const AttachMenu : FunctionComponent < AttachMenuProps > = ( {
@@ -61,6 +63,7 @@ export const AttachMenu: FunctionComponent<AttachMenuProps> = ({
6163 menuSearchProps,
6264 menuSearchInputProps,
6365 searchInputProps,
66+ hasSearchInput = true ,
6467 ...props
6568} : AttachMenuProps ) => (
6669 < Dropdown
@@ -73,16 +76,18 @@ export const AttachMenu: FunctionComponent<AttachMenuProps> = ({
7376 onSelect = { onSelect }
7477 { ...props }
7578 >
76- < MenuSearch { ...menuSearchProps } >
77- < MenuSearchInput { ...menuSearchInputProps } >
78- < SearchInput
79- aria-label = { searchInputAriaLabel }
80- onChange = { ( _event , value ) => handleTextInputChange ( value ) }
81- placeholder = { searchInputPlaceholder }
82- { ...searchInputProps }
83- />
84- </ MenuSearchInput >
85- </ MenuSearch >
79+ { hasSearchInput && (
80+ < MenuSearch { ...menuSearchProps } >
81+ < MenuSearchInput { ...menuSearchInputProps } >
82+ < SearchInput
83+ aria-label = { searchInputAriaLabel }
84+ onChange = { ( _event , value ) => handleTextInputChange && handleTextInputChange ( value ) }
85+ placeholder = { searchInputPlaceholder }
86+ { ...searchInputProps }
87+ />
88+ </ MenuSearchInput >
89+ </ MenuSearch >
90+ ) }
8691 { filteredItems }
8792 </ Dropdown >
8893) ;
0 commit comments