react-component/table

📋 Low-level table primitives for React, maintained in the Ant Design ecosystem.

TypeScript

1,373

1,425 commits

updated Sep 14, 2026

See the code

README

@rc-component/table

Ant Design Part of the Ant Design ecosystem.

📋 Low-level table primitives for React, maintained in the Ant Design ecosystem.

NPM version npm downloads build status Codecov bundle size dumi

English | 简体中文

Highlights

  • Flexible column, summary, fixed header, sticky, expandable row, and virtual table support.
  • TypeScript-first API designed for composition in design systems.
  • Used by Ant Design Table and other React data display experiences.

Install

npm install @rc-component/table

Usage

import Table from '@rc-component/table';
import type { ColumnsType } from '@rc-component/table';

interface User {
  key: string;
  name: string;
  age: number;
  address: string;
}

const columns: ColumnsType<User> = [
  { title: 'Name', dataIndex: 'name', key: 'name', width: 120 },
  { title: 'Age', dataIndex: 'age', key: 'age', width: 80 },
  { title: 'Address', dataIndex: 'address', key: 'address' },
];

const data: User[] = [
  { key: '1', name: 'Jack', age: 28, address: 'Somewhere' },
  { key: '2', name: 'Rose', age: 36, address: 'Somewhere else' },
];

export default () => <Table columns={columns} data={data} />;

Examples

Run the local dumi site:

npm install
npm start

Then open http://localhost:8000.

API

Properties

NameTypeDefaultDescription
tableLayoutauto | fixedauto | fixed for any columns is fixed or ellipsis or header is fixedhttps://developer.mozilla.org/en-US/docs/Web/CSS/table-layout
prefixClsStringrc-table
classNameStringadditional className
idStringidentifier of the container div
useFixedHeaderBooleanfalsewhether use separator table for header. better set width for columns
scrollObject{x: false, y: false}whether table can be scroll in x/y direction, x or y can be a number that indicated the width and height of table body
expandableObjectConfig expand props
expandable.defaultExpandAllRowsBooleanfalseExpand All Rows initially
expandable.defaultExpandedRowKeysString[][]initial expanded rows keys
expandable.expandedRowKeysString[]current expanded rows keys
expandable.expandedRowRenderFunction(recode, index, indent, expanded):ReactNodeContent render to expanded row
expandable.forceRenderBooleanfalseForce render expanded row content before expansion. In virtual mode, only rows currently mounted by the virtual list are force-rendered; off-screen rows may still be unmounted
expandable.expandedRowClassNamestring | (recode, index, indent) => stringget expanded row's className
expandable.columnTitleReactNode | Function({ expandIcon })Customize expand column title
expandable.expandRowByClickbooleanSupport expand by click row
expandable.expandIconColumnIndexNumber0The index of expandIcon which column will be inserted when expandIconAsCell is false
expandable.expandIconprops => ReactNodeDeprecated. Use components.ExpandIcon; retained as a row-only fallback
expandable.indentSizeNumber15indentSize for every level of data.i.children, better using with column.width specified
expandable.rowExpandable(record) => booleanConfig row support expandable
expandable.showExpandAllBooleanfalseShow expand all icon in the expand column header when using expandedRowRender
expandable.onExpandFunction(expanded, record)function to call when click expand icon
expandable.onExpandAllFunction(expanded)function to call when click expand all icon
expandable.onExpandedRowsChangeFunction(expandedRows)function to call when the expanded rows change
expandable.fixedString | Boolean-this expand icon will be fixed when table scroll horizontally: true or left or right and expandIconColumnIndex need to stay first or last
rowKeystring or Function(record, index):string'key'If rowKey is string, record[rowKey] will be used as key. If rowKey is function, the return value of rowKey(record, index) will be use as key.
rowClassNamestring or Function(record, index, indent):stringget row's className
rowRefFunction(record, index, indent):stringget row's ref key
dataObject[]data record array to be rendered
onRowFunction(record, index)Set custom props per each row.
onHeaderRowFunction(record, index)Set custom props per each header row.
showHeaderBooleantruewhether table head is shown
hiddenBooleanfalseHidden column.
titleFunction(currentData)table title render function
footerFunction(currentData)table footer render function
emptyTextReact.Node or FunctionNo DataDisplay text when data is empty
columnsObject[]The columns config of table, see table below
componentsObjectOverride table elements, see #171 for more details
components.ExpandIconReact.ComponentType<ExpandIconProps>Customize both row and expand-all icons. Receives type (row or all), prefixCls, expanded, expandable, onClick, and record for rows only
stickyboolean | {offsetHeader?: number, offsetScroll?: number, getContainer?: () => Window | HTMLElement }falsestick header and scroll bar
summary(data: readonly RecordType[]) => React.ReactNode-summary attribute in table component is used to define the summary row.
rowHoverablebooleantrueTable hover interaction

Methods

scrollTo

Table component exposes scrollTo method to scroll to a specific position:

const tblRef = useRef();
tblRef.current?.scrollTo({ key: 'rowKey', align: 'start' });
NameTypeDefaultDescription
indexnumber-Row index to scroll to
topnumber-Scroll to specific top position (in px)
keystring-Scroll to row by row key
offsetnumber-Additional offset from target position
alignstart | center | end | nearestnearestAlignment of the target element within the scroll container. start aligns to top, center to middle, end to bottom, nearest automatically chooses the closest alignment. Note: Virtual table does not support center.

Column Props

NameTypeDefaultDescription
keyStringkey of this column
classNameStringclassName of this column
colSpanNumberthead colSpan of this column
titleReact Nodetitle of this column
dataIndexStringdisplay field of the data record
widthString | Numberwidth of the specific proportion calculation according to the width of the columns
minWidthNumberthe minimum width of the column, only worked when tableLayout is auto
fixedString | Booleanthis column will be fixed when table scroll horizontally: true or 'left' or 'right'
alignStringspecify how cell content is aligned
ellipsisBooleanspecify whether cell content be ellipsized
rowScope'row' | 'rowgroup'Set scope attribute for all cells in this column
onCellFunction(record, index)Set custom props per each cell.
onHeaderCellFunction(record)Set custom props per each header cell.
renderFunction(value, row, index)The render function of cell, has three params: the text of this cell, the record of this row, the index of this row, it's return an object:{ children: value, props: { colSpan: 1, rowSpan:1 } } ==> 'children' is the text of this cell, props is some setting of this cell, eg: 'colspan' set td colspan, 'rowspan' set td rowspan

Summary Props

Table.Summary

NameTypeDefaultDescription
keyStringkey of this summary
fixedboolean | 'top' | 'bottom'-true fixes the summary row at the bottom of the table. top fixes the summary row at the top of the table, while bottom fixes it at the bottom. undefined or false makes the summary row scrollable along with the table.

Table.Summary.Row

NameTypeDefaultDescription
keyStringkey of this summary
classNameString-className of this summary row
styleReact.CSSProperties-style of this summary row
onClick(e?: React.MouseEvent<HTMLElement>) => void-The onClick attribute in Table.Summary.Row component can be used to set a click event handler for the summary row.

Development

npm install
npm start

The dumi site runs at http://localhost:8000 by default.

Run checks before sending a pull request:

npm run lint
npm run tsc
npm test
npm run build

Release

npm run prepublishOnly

The release flow is handled by @rc-component/np through the rc-np command after the package build.

Ecosystem

This package is part of the React Component organization and is maintained alongside Ant Design. The Ant Design mark above is used only as ecosystem context; the package itself stays framework-level and unstyled except for its bundled assets.

License

@rc-component/table is released under the MIT license.

antd
ant-design
javascript
react
react-component

react-component/table

📋 Low-level table primitives for React, maintained in the Ant Design ecosystem.

TypeScript

1,373

1,425 commits

updated Sep 14, 2026

See the code

README

@rc-component/table

Ant Design Part of the Ant Design ecosystem.

📋 Low-level table primitives for React, maintained in the Ant Design ecosystem.

NPM version npm downloads build status Codecov bundle size dumi

English | 简体中文

Highlights

  • Flexible column, summary, fixed header, sticky, expandable row, and virtual table support.
  • TypeScript-first API designed for composition in design systems.
  • Used by Ant Design Table and other React data display experiences.

Install

npm install @rc-component/table

Usage

import Table from '@rc-component/table';
import type { ColumnsType } from '@rc-component/table';

interface User {
  key: string;
  name: string;
  age: number;
  address: string;
}

const columns: ColumnsType<User> = [
  { title: 'Name', dataIndex: 'name', key: 'name', width: 120 },
  { title: 'Age', dataIndex: 'age', key: 'age', width: 80 },
  { title: 'Address', dataIndex: 'address', key: 'address' },
];

const data: User[] = [
  { key: '1', name: 'Jack', age: 28, address: 'Somewhere' },
  { key: '2', name: 'Rose', age: 36, address: 'Somewhere else' },
];

export default () => <Table columns={columns} data={data} />;

Examples

Run the local dumi site:

npm install
npm start

Then open http://localhost:8000.

API

Properties

NameTypeDefaultDescription
tableLayoutauto | fixedauto | fixed for any columns is fixed or ellipsis or header is fixedhttps://developer.mozilla.org/en-US/docs/Web/CSS/table-layout
prefixClsStringrc-table
classNameStringadditional className
idStringidentifier of the container div
useFixedHeaderBooleanfalsewhether use separator table for header. better set width for columns
scrollObject{x: false, y: false}whether table can be scroll in x/y direction, x or y can be a number that indicated the width and height of table body
expandableObjectConfig expand props
expandable.defaultExpandAllRowsBooleanfalseExpand All Rows initially
expandable.defaultExpandedRowKeysString[][]initial expanded rows keys
expandable.expandedRowKeysString[]current expanded rows keys
expandable.expandedRowRenderFunction(recode, index, indent, expanded):ReactNodeContent render to expanded row
expandable.forceRenderBooleanfalseForce render expanded row content before expansion. In virtual mode, only rows currently mounted by the virtual list are force-rendered; off-screen rows may still be unmounted
expandable.expandedRowClassNamestring | (recode, index, indent) => stringget expanded row's className
expandable.columnTitleReactNode | Function({ expandIcon })Customize expand column title
expandable.expandRowByClickbooleanSupport expand by click row
expandable.expandIconColumnIndexNumber0The index of expandIcon which column will be inserted when expandIconAsCell is false
expandable.expandIconprops => ReactNodeDeprecated. Use components.ExpandIcon; retained as a row-only fallback
expandable.indentSizeNumber15indentSize for every level of data.i.children, better using with column.width specified
expandable.rowExpandable(record) => booleanConfig row support expandable
expandable.showExpandAllBooleanfalseShow expand all icon in the expand column header when using expandedRowRender
expandable.onExpandFunction(expanded, record)function to call when click expand icon
expandable.onExpandAllFunction(expanded)function to call when click expand all icon
expandable.onExpandedRowsChangeFunction(expandedRows)function to call when the expanded rows change
expandable.fixedString | Boolean-this expand icon will be fixed when table scroll horizontally: true or left or right and expandIconColumnIndex need to stay first or last
rowKeystring or Function(record, index):string'key'If rowKey is string, record[rowKey] will be used as key. If rowKey is function, the return value of rowKey(record, index) will be use as key.
rowClassNamestring or Function(record, index, indent):stringget row's className
rowRefFunction(record, index, indent):stringget row's ref key
dataObject[]data record array to be rendered
onRowFunction(record, index)Set custom props per each row.
onHeaderRowFunction(record, index)Set custom props per each header row.
showHeaderBooleantruewhether table head is shown
hiddenBooleanfalseHidden column.
titleFunction(currentData)table title render function
footerFunction(currentData)table footer render function
emptyTextReact.Node or FunctionNo DataDisplay text when data is empty
columnsObject[]The columns config of table, see table below
componentsObjectOverride table elements, see #171 for more details
components.ExpandIconReact.ComponentType<ExpandIconProps>Customize both row and expand-all icons. Receives type (row or all), prefixCls, expanded, expandable, onClick, and record for rows only
stickyboolean | {offsetHeader?: number, offsetScroll?: number, getContainer?: () => Window | HTMLElement }falsestick header and scroll bar
summary(data: readonly RecordType[]) => React.ReactNode-summary attribute in table component is used to define the summary row.
rowHoverablebooleantrueTable hover interaction

Methods

scrollTo

Table component exposes scrollTo method to scroll to a specific position:

const tblRef = useRef();
tblRef.current?.scrollTo({ key: 'rowKey', align: 'start' });
NameTypeDefaultDescription
indexnumber-Row index to scroll to
topnumber-Scroll to specific top position (in px)
keystring-Scroll to row by row key
offsetnumber-Additional offset from target position
alignstart | center | end | nearestnearestAlignment of the target element within the scroll container. start aligns to top, center to middle, end to bottom, nearest automatically chooses the closest alignment. Note: Virtual table does not support center.

Column Props

NameTypeDefaultDescription
keyStringkey of this column
classNameStringclassName of this column
colSpanNumberthead colSpan of this column
titleReact Nodetitle of this column
dataIndexStringdisplay field of the data record
widthString | Numberwidth of the specific proportion calculation according to the width of the columns
minWidthNumberthe minimum width of the column, only worked when tableLayout is auto
fixedString | Booleanthis column will be fixed when table scroll horizontally: true or 'left' or 'right'
alignStringspecify how cell content is aligned
ellipsisBooleanspecify whether cell content be ellipsized
rowScope'row' | 'rowgroup'Set scope attribute for all cells in this column
onCellFunction(record, index)Set custom props per each cell.
onHeaderCellFunction(record)Set custom props per each header cell.
renderFunction(value, row, index)The render function of cell, has three params: the text of this cell, the record of this row, the index of this row, it's return an object:{ children: value, props: { colSpan: 1, rowSpan:1 } } ==> 'children' is the text of this cell, props is some setting of this cell, eg: 'colspan' set td colspan, 'rowspan' set td rowspan

Summary Props

Table.Summary

NameTypeDefaultDescription
keyStringkey of this summary
fixedboolean | 'top' | 'bottom'-true fixes the summary row at the bottom of the table. top fixes the summary row at the top of the table, while bottom fixes it at the bottom. undefined or false makes the summary row scrollable along with the table.

Table.Summary.Row

NameTypeDefaultDescription
keyStringkey of this summary
classNameString-className of this summary row
styleReact.CSSProperties-style of this summary row
onClick(e?: React.MouseEvent<HTMLElement>) => void-The onClick attribute in Table.Summary.Row component can be used to set a click event handler for the summary row.

Development

npm install
npm start

The dumi site runs at http://localhost:8000 by default.

Run checks before sending a pull request:

npm run lint
npm run tsc
npm test
npm run build

Release

npm run prepublishOnly

The release flow is handled by @rc-component/np through the rc-np command after the package build.

Ecosystem

This package is part of the React Component organization and is maintained alongside Ant Design. The Ant Design mark above is used only as ecosystem context; the package itself stays framework-level and unstyled except for its bundled assets.

License

@rc-component/table is released under the MIT license.

antd
ant-design
javascript
react
react-component

Project health

Overall

5.4/10

Maintained

7/10

Code review

3/10
OpenSSF Scorecard

Latest release

1.12.0 · Aug 19, 2026

Releases this year

9

Significant stargazers

Kamal Bennani

15 followers · starred Oct 2018

DeepAnchor

55 followers · starred Jan 2024