Reactjs 如何设置与v0文本字段类似的材质UI v1文本字段的样式
在material UI v0 TextField中,可以使用给定的属性正确设置样式。Reactjs 如何设置与v0文本字段类似的材质UI v1文本字段的样式,reactjs,material-ui,Reactjs,Material Ui,在material UI v0 TextField中,可以使用给定的属性正确设置样式。就像这样 <TextField floatingLabelText="New Password" fullWidth={true} underlineStyle={styles.dialogInputUnderlineStyle} underlineFocusStyle={styles.dialogInputUnderlineFocusStyle} err
就像这样
<TextField
floatingLabelText="New Password"
fullWidth={true}
underlineStyle={styles.dialogInputUnderlineStyle}
underlineFocusStyle={styles.dialogInputUnderlineFocusStyle}
errorStyle={styles.dialogInputErrorStyle}
floatingLabelFocusStyle={styles.dialogInputLabelFocus}
floatingLabelStyle={styles.dialogInputLabel}
inputStyle={styles.dialogInputStyle}
style={styles.rootStyle}
hintText="Must be atleast 8 characters long"
hintStyle={styles.dialogInputHintStyle}
type="password"
/>
为了访问输入标签,您可以使用InputLabelProps;对于输入(下划线等),您可以使用InputProps;对于辅助文本,您可以使用FormHelperTextProps 以下是一个例子:
<TextField
defaultValue="react-bootstrap"
label="Bootstrap"
id="bootstrap-input"
InputProps={{
disableUnderline: true,
classes: {
root: classes.root,
input: classes.input,
},
}}
InputLabelProps={{
shrink: true,
className: classes.label,
}}
FormHelperTextProps={{
classes:{
root: classes.yourCSS,
error: classes.yourErrorCSS
}
}}
/>
在这里,您应该使用和
在材质界面中
请参考此处的API:我已经阅读了API文档。但我不明白。你能给出一个简单的类的例子吗?
<TextField
defaultValue="react-bootstrap"
label="Bootstrap"
id="bootstrap-input"
InputProps={{
disableUnderline: true,
classes: {
root: classes.root,
input: classes.input,
},
}}
InputLabelProps={{
shrink: true,
className: classes.label,
}}
FormHelperTextProps={{
classes:{
root: classes.yourCSS,
error: classes.yourErrorCSS
}
}}
/>