TableCell

TableCell API

The API documentation of the TableCell React component. Learn more about the properties and the CSS customization points.

import TableCell from '@material-ui/core/TableCell';

Props

Name Type Default Description
align enum: 'inherit', 'left', 'center', 'right', 'justify'
'inherit' Set the text-align on the table cell content.
Monetary or generally number fields should be right aligned as that allows you to add them up quickly in your head without having to worry about decimals.
children node The table cell contents.
classes object Override or extend the styles applied to the component. See CSS API below for more details.
component componentPropType The component used for the root node. Either a string to use a DOM element or a component.
numeric bool Deprecated. Instead, use the align property.

If true, content will align to the right.
padding enum: 'default' |
 'checkbox' |
 'dense' |
 'none'
Sets the padding applied to the cell. By default, the Table parent component set the value.
scope string Set scope attribute.
sortDirection enum: 'asc' |
 'desc' |
 false
Set aria-sort direction.
variant enum: 'head' |
 'body' |
 'footer'
Specify the cell type. By default, the TableHead, TableBody or TableFooter parent component set the value.

Any other properties supplied will be spread to the root element (native element).

CSS

You can override all the class names injected by Material-UI thanks to the classes property. This property accepts the following keys:

Name Description
root Styles applied to the root element.
head Styles applied to the root element if variant="head" or context.table.head.
body Styles applied to the root element if variant="body" or context.table.body.
footer Styles applied to the root element if variant="footer" or context.table.footer.
numeric Styles applied to the root element if numeric={true}.
paddingDense Styles applied to the root element if padding="dense".
paddingCheckbox Styles applied to the root element if padding="checkbox".
paddingNone Styles applied to the root element if padding="none".
alignLeft Styles applied to the root element if align="left".
alignCenter Styles applied to the root element if align="center".
alignRight Styles applied to the root element if align="right".
alignJustify Styles applied to the root element if align="justify".

Have a look at overriding with classes section and the implementation of the component for more detail.

If using the overrides key of the theme, you need to use the following style sheet name: MuiTableCell.

Demos