在dropzone-material-ui

时间:2019-09-19 05:34:09

标签: reactjs material-ui

如何使用makeStyles更改material-ui-dropzone组件的样式?

我的useStyle是:

const useStyles = makeStyles(theme => ({
    DropzoneArea: {                
        fontWeight: 10,
        margin:0,
        padding:0                
    }
}

and in app.js i use this:

<DropzoneArea                                
    acceptedFiles={['image/*']}
    maxFileSize={10000000}
    filesLimit={1}                                                                                   
    dropzoneClass={classes.DropzoneArea}                        
/>

2 个答案:

答案 0 :(得分:0)

我认为您不能使用makeStyles对其进行样式设置。

最好的方法是从检查器中获取p元素的类名称并设置其样式。它对我有用。

.MuiDropzoneArea-text {
        .....Your style here
}

根据需要用“!important” 标记样式。

答案 1 :(得分:0)

您可以使用以下类:

dropzoneParagraphClass="dropzone-text"

在您的 .css 文件中,您可以设置文本样式:

.dropzone-text {
    font-size: 100px !important; /* or something */
}