【发布时间】:2021-12-24 17:07:25
【问题描述】:
在我的 Gatsby 应用程序中,我使用的是 MUI v5,并且还必须输出用户创建的标记。我希望用户标记获得与其类似的Typography 元素相同的基本样式(见下文)。我怎样才能做到这一点?
注意——用户标记已经包含<p><h1>或其他标签,React不能直接修改。
此外,该应用使用 ThemeProvider 包装,我使用 styled-components 作为 MUI 的样式引擎(如果这很重要的话......)。
import {Typography} from "@mui/material"
export default function() {
return (
<>
<Typography variant="body1" paragraph>My styled Typography</Typography>
// The next line can't receive any classses or modifiers,
// but must end up styled like the <Typography> element.
<p>my custom user content - how can i style this like above?</p>
</>
)
}
【问题讨论】:
标签: reactjs material-ui