Answers for "how to get value from autocomplete material ui"

-1

autocomplete default value material-ui

<Autocomplete
    id="id"
    options={Options}
    getOptionLabel={option => option.label}
    defaultvalue={Options.find(v => v.label[0])} 
    renderInput={params => (
      <TextField {...params} label="label" variant="outlined" />
    )}
  />
Posted by: Guest on September-29-2020
2

how to get value from autocomplete material ui

<Autocomplete
    onChange={(event, value) => console.log(value)} // prints the selected value
    .....
    renderInput={params => (
        <TextField {...params} label="Label" variant="outlined" fullWidth />
    )}
/>
Posted by: Guest on November-10-2020
0

material ui autocomple how make first option is selected as default

<Autocomplete
    id="id"
    options={Options}
    getOptionLabel={option => option.label}
    defaultValue={Options.find(v => v.label[0])} 
    renderInput={params => (
      <TextField {...params} label="label" variant="outlined" />
    )}
  />
Posted by: Guest on September-29-2020
1

how to set dynamic autocomplete with material ui

import React, { useState } from 'react';
using useState:

   const [val,setVal]=useState({})
changin value on click of button

  const handleClick = () => {
    setVal(top100Films[0]);//you pass any value from the array of top100Films
   // set value in TextField from dropdown list
 };
and pass this value to component in render

 <Autocomplete
   value={val}
    options={top100Films}
    getOptionLabel={option => option.title}
    style={{ width: 300 }}
    renderInput={params => (
      <TextField
        {...params}
        label="Combo box"
        variant="outlined"
        fullWidth

      />
    )}
  />
Posted by: Guest on June-07-2020

Code answers related to "how to get value from autocomplete material ui"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language