tag autocomplete

This commit is contained in:
ari committed 2022-05-26 21:49:28 -04:00
1 parent fb8eb4f38c
commit 5729b74c89
22 files changed
+515 -191

No files matched your search

@@ -0,0 +1,40 @@
import TextField from "@mui/material/TextField";
import Autocomplete from "@mui/material/Autocomplete";
export interface InputAutoTextProps {
label: string;
value: string;
options?: string[];
error?: string;
onChange: (v: string) => void;
}
export default function InputAutoText({
value = "",
label,
options = [],
onChange,
error,
}: InputAutoTextProps) {
return <Autocomplete
freeSolo
value={value}
options={options}
onChange={(_e, v) => onChange(
v === null ? "" : v
)}
renderInput={params => <TextField
{...params}
variant="filled"
label={label}
error={error !== undefined}
helperText={error}
onChange={e => {
e.preventDefault();
onChange(
e.target.value
)
}}
/>}
/>
}