TableCell API
API reference docs for the React TableCell component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import TableCell from '@mui/material/TableCell';
// or
import { TableCell } from '@mui/material';
Learn about the difference by reading this guide on minimizing bundle size.
The component renders a <th>
element when the parent context is a header
or otherwise a <td>
element.
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
align | 'center' | 'inherit' | 'justify' | 'left' | 'right' | 'inherit' | Set the text-align on the table cell content. |
children | node | - | The content of the component. |
classes | object | - | Override or extend the styles applied to the component. See CSS classes API below for more details. |
component | elementType | - | The component used for the root node. Either a string to use a HTML element or a component. |
padding | 'checkbox' | 'none' | 'normal' | - | Sets the padding applied to the cell. The prop defaults to the value ( |
scope | string | - | Set scope attribute. |
size | 'medium' | 'small' | string | - | Specify the size of the cell. The prop defaults to the value ( |
sortDirection | 'asc' | 'desc' | false | - | Set aria-sort direction. |
sx | Array<func | object | bool> | func | object | - | The system prop that allows defining system overrides as well as additional CSS styles. See the `sx` page for more details. |
variant | 'body' | 'footer' | 'head' | string | - | Specify the cell type. The prop defaults to the value inherited from the parent TableHead, TableBody, or TableFooter components. |
ref
is forwarded to the root element.Theme default props
You can use MuiTableCell
to change the default props of this component with the theme.
These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.
Class name | Rule name | Description |
---|---|---|
.MuiTableCell-alignCenter | alignCenter | Styles applied to the root element if align="center" . |
.MuiTableCell-alignJustify | alignJustify | Styles applied to the root element if align="justify" . |
.MuiTableCell-alignLeft | alignLeft | Styles applied to the root element if align="left" . |
.MuiTableCell-alignRight | alignRight | Styles applied to the root element if align="right" . |
.MuiTableCell-body | body | Styles applied to the root element if variant="body" or context.table.body . |
.MuiTableCell-footer | footer | Styles applied to the root element if variant="footer" or context.table.footer . |
.MuiTableCell-head | head | Styles applied to the root element if variant="head" or context.table.head . |
.MuiTableCell-paddingCheckbox | paddingCheckbox | Styles applied to the root element if padding="checkbox" . |
.MuiTableCell-paddingNone | paddingNone | Styles applied to the root element if padding="none" . |
.MuiTableCell-root | root | Styles applied to the root element. |
.MuiTableCell-sizeMedium | sizeMedium | Styles applied to the root element if size="medium" . |
.MuiTableCell-sizeSmall | sizeSmall | Styles applied to the root element if size="small" . |
.MuiTableCell-stickyHeader | stickyHeader | Styles applied to the root element if context.table.stickyHeader={true} . |
You can override the style of the component using one of these customization options:
- With a global class name.
- With a rule name as part of the component's
styleOverrides
property in a custom theme.
Source code
If you did not find the information in this page, consider having a look at the implementation of the component for more detail.