How to use the @material-ui/lab/useAutocomplete function in @material-ui/lab

To help you get started, we’ve selected a few @material-ui/lab examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mui-org / material-ui / docs / src / pages / components / autocomplete / UseAutocomplete.tsx View on Github external
export default function UseAutocomplete() {
  const classes = useStyles();
  const {
    getRootProps,
    getInputLabelProps,
    getInputProps,
    getListboxProps,
    getOptionProps,
    groupedOptions,
  } = useAutocomplete({
    id: 'use-autocomplete-demo',
    options: top100Films,
    getOptionLabel: option => option.title,
  });

  return (
    <div>
      <div>
        <label>
          useAutocomplete
        </label>
        <input>
      </div>
      {groupedOptions.length &gt; 0 ? (
        <ul>
          {groupedOptions.map((option, index) =&gt; (</ul></div>
github mui-org / material-ui / docs / src / pages / components / autocomplete / CustomizedHook.tsx View on Github external
export default function CustomizedHook() {
  const {
    getRootProps,
    getInputLabelProps,
    getInputProps,
    getTagProps,
    getListboxProps,
    getOptionProps,
    groupedOptions,
    value,
    focused,
    setAnchorEl,
  } = useAutocomplete({
    id: 'customized-hook-demo',
    defaultValue: [top100Films[1]],
    multiple: true,
    options: top100Films,
    getOptionLabel: option =&gt; option.title,
  });

  return (
    <div>
      <div>
        <label>Customized hook</label>
        
          {value.map((option: FilmOptionType, index: number) =&gt; (
            
          ))}
          <input></div></div>
github mui-org / material-ui / docs / src / pages / components / autocomplete / UseAutocomplete.js View on Github external
export default function UseAutocomplete() {
  const classes = useStyles();
  const {
    getRootProps,
    getInputLabelProps,
    getInputProps,
    getListboxProps,
    getOptionProps,
    groupedOptions,
  } = useAutocomplete({
    id: 'use-autocomplete-demo',
    options: top100Films,
    getOptionLabel: option =&gt; option.title,
  });

  return (
    <div>
      <div>
        <label>
          useAutocomplete
        </label>
        <input>
      </div>
      {groupedOptions.length &gt; 0 ? (
        <ul>
          {groupedOptions.map((option, index) =&gt; (</ul></div>
github mui-org / material-ui / docs / src / pages / components / autocomplete / CustomizedHook.js View on Github external
export default function CustomizedHook() {
  const {
    getRootProps,
    getInputLabelProps,
    getInputProps,
    getTagProps,
    getListboxProps,
    getOptionProps,
    groupedOptions,
    value,
    focused,
    setAnchorEl,
  } = useAutocomplete({
    id: 'customized-hook-demo',
    defaultValue: [top100Films[1]],
    multiple: true,
    options: top100Films,
    getOptionLabel: option =&gt; option.title,
  });

  return (
    <div>
      <div>
        <label>Customized hook</label>
        
          {value.map((option, index) =&gt; (
            
          ))}
</div></div>