UNPKG

@mui/material

Version:

Quickly build beautiful React apps. MUI is a simple and customizable component library to build faster, beautiful, and more accessible React applications. Follow your own design system, or start with Material Design.

83 lines (78 loc) 2.54 kB
import * as React from 'react'; import { SxProps } from '@mui/system'; import { InternalStandardProps as StandardProps, Theme } from '..'; import { TableCellClasses } from './tableCellClasses'; /** * `<TableCell>` will be rendered as an `<th>`or `<td>` depending * on the context it is used in. Where context literally is the * React `context`. * * Since it is not decided via prop, we have create loose typings * here. */ export interface TableCellProps extends StandardProps<TableCellBaseProps, 'align'> { /** * 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. * @default 'inherit' */ align?: 'inherit' | 'left' | 'center' | 'right' | 'justify'; /** * The content of the component. */ children?: React.ReactNode; /** * Override or extend the styles applied to the component. */ classes?: Partial<TableCellClasses>; /** * The component used for the root node. * Either a string to use a HTML element or a component. */ component?: React.ElementType<TableCellBaseProps>; /** * Sets the padding applied to the cell. * The prop defaults to the value (`'default'`) inherited from the parent Table component. */ padding?: 'normal' | 'checkbox' | 'none'; /** * Set scope attribute. */ scope?: TableCellBaseProps['scope']; /** * Specify the size of the cell. * The prop defaults to the value (`'medium'`) inherited from the parent Table component. */ size?: 'small' | 'medium'; /** * Set aria-sort direction. */ sortDirection?: SortDirection; /** * The system prop that allows defining system overrides as well as additional CSS styles. */ sx?: SxProps<Theme>; /** * Specify the cell type. * The prop defaults to the value inherited from the parent TableHead, TableBody, or TableFooter components. */ variant?: 'head' | 'body' | 'footer'; } export type TableCellBaseProps = React.ThHTMLAttributes<HTMLTableCellElement> & React.TdHTMLAttributes<HTMLTableCellElement>; export type SortDirection = 'asc' | 'desc' | false; /** * The component renders a `<th>` element when the parent context is a header * or otherwise a `<td>` element. * * Demos: * * - [Tables](https://mui.com/components/tables/) * * API: * * - [TableCell API](https://mui.com/api/table-cell/) */ export default function TableCell(props: TableCellProps): JSX.Element;