简体   繁体   中英

material ui, how to change background color, font color, border color of autocomplete textfield

How can I change the background color, font color, and border color of this material-ui autocomplete textfield (combobox)? I would like to use css. this is what I have tried so far.

    <Autocomplete
      disablePortal
      id="combo-box-demo"
      options={clients}
      className="test"
      renderInput={(params) => <TextField {...params} label="Movie" />}
    />

css class

.test {
  .MuiAutocomplete-listbox {
    color: red;
  }
}

Since you would like to use css, you can change colors like this:

.test fieldset {
  border-color: red;
}

.test .MuiInputBase-root:hover fieldset {
  border-color: blue;
}

.test input {
  color: red;
}

.test label {
  color: red;
}

.test {
  background-color: yellow;
}

You can take a look at this sandbox for a live working example.

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