How to increase the font size for the Table component

无人久伴 提交于 2019-12-10 18:43:38

问题


I'm beginning to evaluate material-ui as an alternative for a project and I would like to know what is the recommended way to change the font size for a table.

Currently I'm playing with the component's sandbox (available at https://codesandbox.io/s/9onokxxn5w) but I couldn't find what to change in order to enlarge the font size.

I tried to change the theme in demo.js adding a fontSize key to the table element, as follows, but it didn't work:

const styles = theme => ({
    root: {
        width: '100%',
        marginTop: theme.spacing.unit * 3,
        overflowX: 'auto',
    },
    table: {
        minWidth: 700,
        fontSize: '40pt'
    },
});

Thanks in advance for any help in figuring this out.


回答1:


It seems that it does not work for Table but it works for the TabelRow or for the TableCell. Add a class to the TableRow element and set the fontSize param on it

...
<TableRow key={n.id} className={classes.tablecell}>
...

 const styles = theme => ({
        root: {
            width: '100%',
            marginTop: theme.spacing.unit * 3,
            overflowX: 'auto',
        },
        table: {
            minWidth: 700
        },
        tablecell: {,
            fontSize: '40pt'
        }
    });   


来源:https://stackoverflow.com/questions/48301906/how-to-increase-the-font-size-for-the-table-component

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!