Skip to content

Commit

Permalink
[Autocomplete] Document value equality check (#18516)
Browse files Browse the repository at this point in the history
Chawin Tan authored and oliviertassinari committed Nov 24, 2019
1 parent 75697b3 commit a186ae3
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/pages/api/autocomplete.md
Original file line number Diff line number Diff line change
@@ -68,7 +68,7 @@ You can learn more about the difference by [reading this guide](/guides/minimizi
| <span class="prop-name required">renderInput&nbsp;*</span> | <span class="prop-type">func</span> | | Render the input.<br><br>**Signature:**<br>`function(params: object) => ReactNode`<br>*params:* null |
| <span class="prop-name">renderOption</span> | <span class="prop-type">func</span> | | Render the option, use `getOptionLabel` by default.<br><br>**Signature:**<br>`function(option: any, state: object) => ReactNode`<br>*option:* The option to render.<br>*state:* The state of the component. |
| <span class="prop-name">renderTags</span> | <span class="prop-type">func</span> | | Render the selected value.<br><br>**Signature:**<br>`function(value: any, getTagProps: function) => ReactNode`<br>*value:* The `value` provided to the component.<br>*getTagProps:* A tag props getter. |
| <span class="prop-name">value</span> | <span class="prop-type">any</span> | | The value of the autocomplete. |
| <span class="prop-name">value</span> | <span class="prop-type">any</span> | | The value of the autocomplete.<br>The value must have reference equality with the option in order to be selected. You can customize the equality behavior with the `getOptionSelected` prop. |

The `ref` is forwarded to the root element.

3 changes: 3 additions & 0 deletions packages/material-ui-lab/src/Autocomplete/Autocomplete.js
Original file line number Diff line number Diff line change
@@ -612,6 +612,9 @@ Autocomplete.propTypes = {
renderTags: PropTypes.func,
/**
* The value of the autocomplete.
*
* The value must have reference equality with the option in order to be selected.
* You can customize the equality behavior with the `getOptionSelected` prop.
*/
value: PropTypes.any,
};
Original file line number Diff line number Diff line change
@@ -153,6 +153,9 @@ export interface UseAutocompleteProps {
options?: any[];
/**
* The value of the autocomplete.
*
* The value must have reference equality with the option in order to be selected.
* You can customize the equality behavior with the `getOptionSelected` prop.
*/
value?: any;
}

0 comments on commit a186ae3

Please sign in to comment.