Skip to content

Commit

Permalink
[Autocomplete] Improve getOptionSelected description (mui#23817)
Browse files Browse the repository at this point in the history
  • Loading branch information
shivamkataria2000 authored Dec 2, 2020
1 parent 8d10131 commit 3faa5a9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/pages/api-docs/autocomplete.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ The `MuiAutocomplete` name can be used for providing [default props](/customizat
| <span class="prop-name">getLimitTagsText</span> | <span class="prop-type">func</span> | <span class="prop-default">(more) => `+${more}`</span> | The label to display when the tags are truncated (`limitTags`).<br><br>**Signature:**<br>`function(more: number) => ReactNode`<br>*more:* The number of truncated tags. |
| <span class="prop-name">getOptionDisabled</span> | <span class="prop-type">func</span> | | Used to determine the disabled state for a given option.<br><br>**Signature:**<br>`function(option: T) => boolean`<br>*option:* The option to test. |
| <span class="prop-name">getOptionLabel</span> | <span class="prop-type">func</span> | <span class="prop-default">(option) => option.label ?? option</span> | 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).<br><br>**Signature:**<br>`function(option: T) => string`<br> |
| <span class="prop-name">getOptionSelected</span> | <span class="prop-type">func</span> | | Used to determine if an option is selected, considering the current value. Uses strict equality by default.<br><br>**Signature:**<br>`function(option: T, value: T) => boolean`<br>*option:* The option to test.<br>*value:* The value to test against. |
| <span class="prop-name">getOptionSelected</span> | <span class="prop-type">func</span> | | Used to determine if an option is selected, considering the current value(s). Uses strict equality by default. ⚠️ Both arguments need to be handled, an option can only match with one value.<br><br>**Signature:**<br>`function(option: T, value: T) => boolean`<br>*option:* The option to test.<br>*value:* The value to test against. |
| <span class="prop-name">groupBy</span> | <span class="prop-type">func</span> | | If provided, the options will be grouped under the returned string. The groupBy value is also used as the text for group headings when `renderGroup` is not provided.<br><br>**Signature:**<br>`function(options: T) => string`<br>*options:* The options to group. |
| <span class="prop-name">handleHomeEndKeys</span> | <span class="prop-type">bool</span> | <span class="prop-default">!props.freeSolo</span> | If `true`, the component handles the "Home" and "End" keys when the popup is open. It should move focus to the first option and last option, respectively. |
| <span class="prop-name">id</span> | <span class="prop-type">string</span> | | This prop is used to help implement the accessibility logic. If you don't provide this prop. It falls back to a randomly generated id. |
Expand Down
3 changes: 2 additions & 1 deletion packages/material-ui/src/Autocomplete/Autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -680,8 +680,9 @@ Autocomplete.propTypes = {
*/
getOptionLabel: PropTypes.func,
/**
* Used to determine if an option is selected, considering the current value.
* Used to determine if an option is selected, considering the current value(s).
* Uses strict equality by default.
* ⚠️ Both arguments need to be handled, an option can only match with one value.
*
* @param {T} option The option to test.
* @param {T} value The value to test against.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ export interface UseAutocompleteProps<
*/
getOptionLabel?: (option: T) => string;
/**
* Used to determine if an option is selected, considering the current value.
* Used to determine if an option is selected, considering the current value(s).
* Uses strict equality by default.
* ⚠️ Both arguments need to be handled, an option can only match with one value.
*
* @param {T} option The option to test.
* @param {T} value The value to test against.
Expand Down

0 comments on commit 3faa5a9

Please sign in to comment.