I want to create an autocomplete multiple but with a comma in selected values. When I choose multiple values, it makes bigger the component. But I want to make autocomplete just like select with multiple option. First image shows how autocomplete behaves in multiple selection. Second image, what I want when multiple selection occurs. my code:
<Autocomplete
disablePortal
id="serviceCities"
name="serviceCities"
value={formik.values.serviceCities}
onChange={(e, value) => formik.setFieldValue("serviceCities", value)}
options={cities}
loading={true}
loadingText="loading..."
multiple={true}
getOptionLabel={type => type.name}
sx={{ width: "100%", mt: "4%" }}
isOptionEqualToValue={(option, value) => option.id === value.id}
renderInput={(params) => <TextField {...params}
label="provide services in"
placeholder="type name of cities"
sx={{ ...styles.autoComplete, width: "100%" }}
InputLabelProps={{ shrink: true }}
error={formik.touched.serviceCities && Boolean(formik.errors.serviceCities)}
helperText={formik.touched.serviceCities && formik.errors.serviceCities}
/>}
/>
how mui autocomplete multipla select shows:
thank you very much!