【发布时间】:2020-10-17 10:16:28
【问题描述】:
我正在使用这样的 TextField:
<TextField
style={styles}
className = "my-3"
fullWidth
id="filterBox"
InputProps={{
endAdornment: <SearchIcon style={{color: "white"}} />,
className: styles.input
}}
variant = "outlined"
label = {this.state.label}
onChange={this.onChangeHandler.bind(this)}
/>
我正在尝试通过以下方式设置样式:
const styles = {
textfield: {
borderRadius: 2,
fontWeight: 'bold',
color: 'white',
height: 48,
width: '150dp',
},
input:{
color: 'white',
borderColor: '#50fbdb',
border: 1
},
formLabelRoot:{
'&$formLabelFocused': {
color: 'red'
}
}
};
文档没有详细说明,所以我一直在搜索并找到:How to style material-ui textfield 但这几乎就是我所做的,但我仍然无法更改文本(更不用说焦点样式了)。
【问题讨论】:
-
你想要文本框的样式是什么?
-
我希望边框为 50fbdb,搜索为粗体和白色。
-
你用material-ui.com/customization/components/…覆盖样式,还要检查道具是否可以帮助你:material-ui.com/api/text-field
-
这正是我一直在阅读的内容。不知道为什么它不起作用
-
为了更好地理解观看此视频:youtu.be/YS9Q4O5hVzI
标签: reactjs material-ui