diff --git a/docs/pages/api/autocomplete.md b/docs/pages/api/autocomplete.md index eef33ea604cbd8..53889bef69dffb 100644 --- a/docs/pages/api/autocomplete.md +++ b/docs/pages/api/autocomplete.md @@ -42,6 +42,7 @@ You can learn more about the difference by [reading this guide](/guides/minimizi | disablePortal | bool | false | Disable the portal behavior. The children stay within it's parent DOM hierarchy. | | filterOptions | func | | A filter function that determines the options that are eligible.

**Signature:**
`function(options: undefined, state: object) => undefined`
*options:* The options to render.
*state:* The state of the component. | | filterSelectedOptions | bool | false | If `true`, hide the selected options from the list box. | +| forcePopupIcon | 'auto'
| bool
| 'auto' | Force the visibility display of the popup icon. | | freeSolo | bool | false | If `true`, the Autocomplete is free solo, meaning that the user input is not bound to provided options. | | getOptionDisabled | func | | Used to determine the disabled state for a given option. | | getOptionLabel | func | x => x | Used to determine the string value for a given option. It's used to fill the input (and the list box options if `renderOption` is not provided). | diff --git a/packages/material-ui-lab/src/Autocomplete/Autocomplete.d.ts b/packages/material-ui-lab/src/Autocomplete/Autocomplete.d.ts index 767a3862d4cade..f6ed2909bb4d43 100644 --- a/packages/material-ui-lab/src/Autocomplete/Autocomplete.d.ts +++ b/packages/material-ui-lab/src/Autocomplete/Autocomplete.d.ts @@ -67,6 +67,10 @@ export interface AutocompleteProps * The children stay within it's parent DOM hierarchy. */ disablePortal?: boolean; + /** + * Force the visibility display of the popup icon. + */ + forcePopupIcon?: true | false | 'auto'; /** * The component used to render the listbox. */ diff --git a/packages/material-ui-lab/src/Autocomplete/Autocomplete.js b/packages/material-ui-lab/src/Autocomplete/Autocomplete.js index b3f87c5254617a..698ce300e04228 100644 --- a/packages/material-ui-lab/src/Autocomplete/Autocomplete.js +++ b/packages/material-ui-lab/src/Autocomplete/Autocomplete.js @@ -201,6 +201,7 @@ const Autocomplete = React.forwardRef(function Autocomplete(props, ref) { disablePortal = false, filterOptions, filterSelectedOptions = false, + forcePopupIcon = 'auto', freeSolo = false, getOptionDisabled, getOptionLabel = x => x, @@ -340,7 +341,7 @@ const Autocomplete = React.forwardRef(function Autocomplete(props, ref) { )} - {freeSolo ? null : ( + {(!freeSolo || forcePopupIcon === true) && forcePopupIcon !== false ? ( {popupIcon} - )} + ) : null} ), }, @@ -504,6 +505,10 @@ Autocomplete.propTypes = { * If `true`, hide the selected options from the list box. */ filterSelectedOptions: PropTypes.bool, + /** + * Force the visibility display of the popup icon. + */ + forcePopupIcon: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.bool]), /** * If `true`, the Autocomplete is free solo, meaning that the user input is not bound to provided options. */