Hi is there any option that Material UI Select component can accept custom string? To not force user to pick only existing value?
Hi is there any option that Material UI Select component can accept custom string? To not force user to pick only existing value?
No, Select component dont provide such functionality. For the same purpose I used the combination of two components: TextField for custom string input and IconMenu for select from the predefined values and set it to the input field.
And it looks almost the same:
I see this is an old post, but if anybody is looking for simpler solution you can use this component with "freeSolo" prop:
The textbox may contain any arbitrary value, but it is advantageous to suggest possible values to the user, e.g., a search field may suggest similar or previous searches to save the user time
That is exactly what you need.
Hi I have got an awesome solution for this use Autocomplete
<Autocomplete
multiple
id="tags-filled"
options={top100Films.map(option => option.title)}
fullWidth
freeSolo
onChange={e => console.log(e.target.value)}
renderInput={params => <TextField {...params} />}
/>
here options are the array of options.
code sandbox link - https://codesandbox.io/s/material-write-and-select-qwe83?file=/src/App.js