【发布时间】:2025-12-23 13:25:06
【问题描述】:
我正在尝试学习在 Typescript React 环境中使用的 material-ui。我在Dialog 中使用以下片段:
...
<React.Fragment>
<Typography variant="body1">
<Box mt={1}>Heading</Box>
</Typography>
<Grid container spacing={3 as GridSpacing}>
<Grid item xs={12} sm={6}>
<TextField
label="MyTextField"
InputProps={{ readOnly: true }}
value={props.event.fromAction}
fullWidth
/>
</Grid>
<Grid item xs={12} sm={6}>
<TextField
label="AnotherTextField"
InputProps={{ readOnly: true }}
value={props.event.request.sourceComponent}
fullWidth
/>
</Grid>
</Grid>
</React.Fragment>
...
有没有人设法将 TextField 组件的文本更改为排版 caption 变体的样式?
【问题讨论】:
标签: reactjs typescript material-ui