Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase the font size for the Table component

Tags:

material-ui

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.

like image 339
Pedro Almeida Avatar asked Jan 17 '18 13:01

Pedro Almeida


People also ask

How do I increase font size in a table?

style=font-size:12px, change 12 to whatever font size suits your needs. You could add this code inline to the <table> tag, the <tr> tag or to each <th> tag. A few options but this is the code you need: style=font-size:12px, change 12 to whatever font size suits your needs.

How do you change the font size in a table in HTML?

To change the font size in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <p> tag, with the CSS property font-size. HTML5 do not support the <font> tag, so the CSS style is used to add font size.


1 Answers

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 => ({
  tablecell: {
    fontSize: '40pt',
  },
});   
like image 91
Aniko Litvanyi Avatar answered Sep 30 '22 15:09

Aniko Litvanyi