Material-ui: [Table] minimum width for "TableRowColumn"

Created on 12 May 2016  路  4Comments  路  Source: mui-org/material-ui

Description

It could be usefull to set the minimum width for a table row column.
In this way when we have a large number of columns the table could automatically show the horizontal overflow.

Table enhancement

Most helpful comment

You could work around it using custom styles:

//...
const styles = {
    longCell: {
        minWidth: '1000px',
    },
    tableWrapper: {
        overflowX: 'auto',
    },
};

const LongTable = ({classes}) => (
    <div className={classes.tableWrapper}>
        <Table>
            <TableHead>
                <TableRow>
                    <TableCell>ID</TableCell>
                    <TableCell className={classes.longCell}>Long Cell</TableCell>
                </TableRow>
            </TableHead>
        </Table>
    </div>
);
//...

All 4 comments

@francescabarbazeni87 could you figure out any solution around that?

You could work around it using custom styles:

//...
const styles = {
    longCell: {
        minWidth: '1000px',
    },
    tableWrapper: {
        overflowX: 'auto',
    },
};

const LongTable = ({classes}) => (
    <div className={classes.tableWrapper}>
        <Table>
            <TableHead>
                <TableRow>
                    <TableCell>ID</TableCell>
                    <TableCell className={classes.longCell}>Long Cell</TableCell>
                </TableRow>
            </TableHead>
        </Table>
    </div>
);
//...

Why not TableCell can not add xs like Grid ??

@AndriusBil Thanks for sharing a solution.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iamzhouyi picture iamzhouyi  路  3Comments

revskill10 picture revskill10  路  3Comments

FranBran picture FranBran  路  3Comments

mattmiddlesworth picture mattmiddlesworth  路  3Comments

anthony-dandrea picture anthony-dandrea  路  3Comments