title: How Can i limit the maximum number of options that can be selected in a Material UI lab Autocomplete component
body: <p>(for instance) I wish to limit user selecting only 3 options in my Autocomplete component, and disable the options when the length of TAG Array reaches 3.
  The problem is there is no limitMaxNumberOfTags option in the api, and i cant get any way to access the Selected tags array whatsoever {except the limitTags, which only limits the visible tags}
  .
  something along the lines of this might help
  <code>getOptionDisabled={(options, tags) =&gt; (tags.length &gt; 3 ? true : false)}</code>
  .
  Here is my autocomplete implementation so far</p>
  <pre class="lang-js prettyprint-override"><code>&lt;Autocomplete
    multiple
    id=&quot;tags-outlined&quot;
    options={students}
    getOptionLabel={(option) =&gt; option.personalInfo.firstName + ' ' + option.personalInfo.lastName}
    defaultValue={[...added]}
    onChange={(e, newVal) =&gt; setAdded([...newVal])}
    renderOption={(option, state) =&gt; {
      return (
        &lt;Chip
          icon={
            &lt;FaceIcon /&gt; /*&lt;Avatar color=&quot;primary&quot; variant='outlined' size=&quot;small&quot; className={classes.small}&gt;&lt;/Avatar&gt;*/
          }
          label={option.personalInfo.firstName + ' ' + option.personalInfo.lastName}
          color=&quot;default&quot;
          variant=&quot;outlined&quot;
          {...state}
        /&gt;
      );
    }}
    renderTags={(options, getTagProps) =&gt;
      options.map((option) =&gt; (
        &lt;Chip
          icon={
            &lt;FaceIcon /&gt; /*&lt;Avatar color=&quot;primary&quot; variant='outlined' size=&quot;small&quot; className={classes.small}&gt;&lt;/Avatar&gt;*/
          }
          label={option.personalInfo.firstName + ' ' + option.personalInfo.lastName}
          color=&quot;primary&quot;
          variant=&quot;outlined&quot;
          {...getTagProps({})}
        /&gt;
      ))
    }
    filterSelectedOptions
    filterOptions={(options, state) =&gt;
      options.filter((option) =&gt; {
        for (let i = 0; i &lt; added.length; i++) {
          if (added[i]._id === option._id) {
            return false;
          }
        }
        return true;
      })
    }
    // ---&gt;         getOptionDisabled={(options) =&gt; (tags.length &gt; 3 ? true : false)}
    renderInput={(params) =&gt; (
      &lt;TextField {...params} variant=&quot;outlined&quot; color=&quot;primary&quot; label=&quot;Select Students&quot; placeholder=&quot;Participant&quot; /&gt;
    )}
  /&gt;
  </code></pre>