diff --git a/.changeset/nasty-dogs-walk.md b/.changeset/nasty-dogs-walk.md new file mode 100644 index 00000000000..c5c0e0188ab --- /dev/null +++ b/.changeset/nasty-dogs-walk.md @@ -0,0 +1,7 @@ +--- +"@primer/react": patch +--- + +Adds the ability to unset `emptyStateText` in Autocomplete.Menu. This results in no menu being rendered. + + diff --git a/src/Autocomplete/AutocompleteMenu.tsx b/src/Autocomplete/AutocompleteMenu.tsx index 6884a94ac68..674c3dce13a 100644 --- a/src/Autocomplete/AutocompleteMenu.tsx +++ b/src/Autocomplete/AutocompleteMenu.tsx @@ -58,7 +58,7 @@ export type AutocompleteMenuInternalProps = { /** * The text that appears in the menu when there are no options in the array passed to the `items` prop. */ - emptyStateText?: React.ReactNode | false + emptyStateText?: React.ReactNode | false | null /** * A custom function used to filter the options in the array passed to the `items` prop. @@ -363,9 +363,9 @@ function AutocompleteMenu(props: AutocompleteMe ) })} - ) : ( + ) : emptyStateText !== false && emptyStateText !== null ? ( {emptyStateText} - )} + ) : null} )}