简体   繁体   中英

Material UI <Autocomplete/> remove browser suggestion

I have problem with Material-ui Autocomplete:

import Autocomplete from "@material-ui/lab/Autocomplete";

I am using then in:

 <Autocomplete
        id="checkboxes-tags-demo"
        autoComplete={false}
        options={states}
        disableCloseOnSelect
        getOptionLabel={(option) => option.name}
        onChange={onStateChange}
        renderOption={(option, { selected }) => (
          <React.Fragment>
            <Checkbox
              icon={icon}
              checkedIcon={checkedIcon}
              style={{ marginRight: 8 }}
              checked={selected}
            />

            {option.name}
          </React.Fragment>
        )}
        style={{ width: "100%" }}
        renderInput={(params) => (
          <TextField
            {...params}
            variant="outlined"
            label="State"
            placeholder="Enter state"
          />
        )}
      />

Nothing important in this code but I face this issue:

在此处输入图片说明

I am getting the browser suggestion. How I can remove it ?

正如在这个 SO question 中提到的,您应该将autoComplete="off"添加到您的 TextField。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM