简体   繁体   English

材质 ui,如何更改自动完成文本字段的背景颜色、字体颜色、边框颜色

[英]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)?如何更改此 material-ui 自动完成文本字段(组合框)的背景颜色、字体颜色和边框颜色? I would like to use css.我想使用 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 css class

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

Since you would like to use css, you can change colors like this:由于您想使用 css,您可以像这样更改 colors:

.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.您可以查看此沙盒以获取实时工作示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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