你应该用<TextField />
来做这个.variant
props 会给你你想要的设计.
<TextField
variant="standard"
sx={{
"& .MuiInput-underline:after": {
borderBottomColor: "green",
},
}}
/>
请注意,还有其他方法,对于styled
或theme
,这是最快的方法,但可能不是那么可伸缩,所以请参考文档以获取更多样式解决方案.
Ref:
https://mui.com/material-ui/react-text-field/
https://mui.com/material-ui/guides/interoperability/#global-css
https://mui.com/material-ui/customization/theme-components/#global-style-overrides