Skip to content

Commit

Permalink
Ability to unset emptyStateText in Autocomplete.Menu (#4002)
Browse files Browse the repository at this point in the history
* Ability to unset emptyStateText in Autocomplete.Menu

Fixes #3966

* unchange

* Create nasty-dogs-walk.md

---------

Co-authored-by: Mike Perrotti <mperrotti@github.com>
  • Loading branch information
peterbe and mperrotti authored Dec 21, 2023
1 parent e33a9f1 commit 1a1d89c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .changeset/nasty-dogs-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@primer/react": patch
---

Adds the ability to unset `emptyStateText` in Autocomplete.Menu. This results in no menu being rendered.

<!-- Changed components: Autocomplete -->
6 changes: 3 additions & 3 deletions src/Autocomplete/AutocompleteMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export type AutocompleteMenuInternalProps<T extends AutocompleteItemProps> = {
/**
* 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.
Expand Down Expand Up @@ -363,9 +363,9 @@ function AutocompleteMenu<T extends AutocompleteItemProps>(props: AutocompleteMe
)
})}
</ActionList>
) : (
) : emptyStateText !== false && emptyStateText !== null ? (
<Box p={3}>{emptyStateText}</Box>
)}
) : null}
</div>
)}
</VisuallyHidden>
Expand Down

0 comments on commit 1a1d89c

Please sign in to comment.