Skip to content

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 elementType The component used for the root node. Either a string to use a DOM element or a component.
padding enum: 'default' |
 'checkbox' |
 'none'
Sets the padding applied to the cell. By default, the Table parent component set the value (default).
scope string Set scope attribute.
size enum: 'small' |
 'medium'
Specify the size of the cell. By default, the Table parent component set the value (medium).
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.

The ref is forwarded to the root element.

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

CSS

You can override all the class names injected by Material-UI thanks to the classes prop. This prop 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.
sizeSmall Styles applied to the root element if size="small".
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 the overriding styles 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.

Notes

The component can cause issues in StrictMode.

Demos