UNPKG

1.76 kBTypeScriptView Raw
1import * as React from 'react';
2import { SxProps } from '@mui/system';
3import { OverridableStringUnion } from '@mui/types';
4import { Theme } from '..';
5import { OverridableComponent, OverrideProps } from '../OverridableComponent';
6import { TableClasses } from './tableClasses';
7
8export interface TablePropsSizeOverrides {}
9
10export interface TableOwnProps {
11 /**
12 * The content of the table, normally `TableHead` and `TableBody`.
13 */
14 children?: React.ReactNode;
15 /**
16 * Override or extend the styles applied to the component.
17 */
18 classes?: Partial<TableClasses>;
19 /**
20 * Allows TableCells to inherit padding of the Table.
21 * @default 'normal'
22 */
23 padding?: 'normal' | 'checkbox' | 'none';
24 /**
25 * Allows TableCells to inherit size of the Table.
26 * @default 'medium'
27 */
28 size?: OverridableStringUnion<'small' | 'medium', TablePropsSizeOverrides>;
29 /**
30 * Set the header sticky.
31 * @default false
32 */
33 stickyHeader?: boolean;
34 /**
35 * The system prop that allows defining system overrides as well as additional CSS styles.
36 */
37 sx?: SxProps<Theme>;
38}
39
40export interface TableTypeMap<
41 AdditionalProps = {},
42 RootComponent extends React.ElementType = 'table',
43> {
44 props: AdditionalProps & TableOwnProps;
45 defaultComponent: RootComponent;
46}
47/**
48 *
49 * Demos:
50 *
51 * - [Table](https://mui.com/material-ui/react-table/)
52 *
53 * API:
54 *
55 * - [Table API](https://mui.com/material-ui/api/table/)
56 */
57declare const Table: OverridableComponent<TableTypeMap>;
58
59export type TableProps<
60 RootComponent extends React.ElementType = TableTypeMap['defaultComponent'],
61 AdditionalProps = {},
62> = OverrideProps<TableTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
63 component?: React.ElementType;
64};
65
66export default Table;