From a81d185f757340319caea7329d1df56fc537ec71 Mon Sep 17 00:00:00 2001 From: willwill96 Date: Mon, 27 Jan 2020 15:45:06 -0700 Subject: [PATCH] Update Autocomplete defaultValue prop doc --- docs/pages/api/autocomplete.md | 2 +- packages/material-ui-lab/src/Autocomplete/Autocomplete.js | 2 +- .../material-ui-lab/src/useAutocomplete/useAutocomplete.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/pages/api/autocomplete.md b/docs/pages/api/autocomplete.md index e12242b9bd08b3..8c58516f4be5db 100644 --- a/docs/pages/api/autocomplete.md +++ b/docs/pages/api/autocomplete.md @@ -35,7 +35,7 @@ You can learn more about the difference by [reading this guide](/guides/minimizi | closeIcon | node | <CloseIcon fontSize="small" /> | The icon to display in place of the default close icon. | | closeText | string | 'Close' | Override the default text for the *close popup* icon button.
For localization purposes, you can use the provided [translations](/guides/localization/). | | debug | bool | false | If `true`, the popup will ignore the blur event if the input if filled. You can inspect the popup markup with your browser tools. Consider this option when you need to customize the component. | -| defaultValue | any
| array
| | The default input value. Use when the component is not controlled. | +| defaultValue | any
| array
| props.multiple ? [] : null | The default input value. Use when the component is not controlled. | | disableClearable | bool | false | If `true`, the input can't be cleared. | | disableCloseOnSelect | bool | false | If `true`, the popup won't close when a value is selected. | | disabled | bool | false | If `true`, the input will be disabled. | diff --git a/packages/material-ui-lab/src/Autocomplete/Autocomplete.js b/packages/material-ui-lab/src/Autocomplete/Autocomplete.js index 25c676bdb14c34..e1697d4cc31383 100644 --- a/packages/material-ui-lab/src/Autocomplete/Autocomplete.js +++ b/packages/material-ui-lab/src/Autocomplete/Autocomplete.js @@ -247,7 +247,7 @@ const Autocomplete = React.forwardRef(function Autocomplete(props, ref) { closeIcon = , closeText = 'Close', debug = false, - defaultValue, + defaultValue = props.multiple ? [] : null, disableClearable = false, disableCloseOnSelect = false, disabled = false, diff --git a/packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js b/packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js index 6e5cfcb14e6db4..00e7ca020f5844 100644 --- a/packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js +++ b/packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js @@ -85,7 +85,7 @@ export default function useAutocomplete(props) { blurOnSelect = false, clearOnEscape = false, debug = false, - defaultValue, + defaultValue = props.multiple ? [] : null, disableClearable = false, disableCloseOnSelect = false, disableListWrap = false, @@ -193,7 +193,7 @@ export default function useAutocomplete(props) { const [value, setValue] = useControlled({ controlled: valueProp, - default: defaultValue || (multiple ? [] : null), + default: defaultValue, name: componentName, });