问题描述
当前,我正在使用Material-UI中的文本字段,并且希望缩小它们.这是类名称的示例:
Currently I'm working with Text Fields in Material-UI and I am wanting to shrink them down.Here is an example of the class name:
.eKdARe.header .input-container输入
.eKdARe.header .input-container input
这里是一个示例,当我在文件中输入更改后,单击刷新后类名会发生什么变化:
Here is an example after I input changes in my file of what happens to class name after I hit refresh:
.hrLLok.header .input-container输入
.hrLLok.header .input-container input
我只想保留一个类名,以便我可以对输入字段进行实际更改.
I just want to keep the one class name so that I can make actual changes to my input fields.
推荐答案
您应使用 @ material-ui/styles
扩展文本字段样式,如下所示:
You should use @material-ui/styles
to extend your Text Fields styles like this:
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Button from '@material-ui/core/Button';
const useStyles = makeStyles({
button: {
border: 0,
borderRadius: 3,
color: 'white',
height: 48,
padding: '0 30px',
// Other styles here...
},
});
export default function MyComponent() {
const classes = useStyles();
return (
<div>
<Button className={classes.button}>My styled boutton</Button>
</div>
);
}
通过以下链接了解有关文档的更多信息: @ material-ui.com/styles
Learn more about the documentation at this link: @material-ui.com/styles
这篇关于我每次刷新时,Material-UI类名称都会不断更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!