
[英]how to remove default value in mui textfield so I can type new value without showing the default one?
[英]Can I add a fixed value that won't be changed also user can type text inside TextField MUI?
我想要这样的东西。
有一个TextField
,在这个组件内部,有一个不会改变的值。
在此值之后,用户可以在You can type here...
文本是但用户无法更改固定值( Display fixed value
文本)。
我们可以有一个固定的值,用户也可以在 MUI TextField
中输入他们的消息吗?
import React from "react";
import { makeStyles } from "@material-ui/core/styles";
import TextField from "@material-ui/core/TextField";
const useStyles = makeStyles(theme => ({
root: {
"& .MuiTextField-root": {
margin: theme.spacing(1)
}
},
textarea: {
resize: "both"
}
}));
export default function MultilineTextFields() {
const classes = useStyles();
return (
<form className={classes.root} noValidate autoComplete="off">
<div>
<TextField
id="outlined-textarea"
label="Multiline Placeholder"
placeholder="Placeholder"
multiline
variant="outlined"
inputProps={{ className: classes.textarea }}
/>
</div>
</form>
);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.