rc-table - React Table Component

7.55.1 · active · verified Sun Apr 19

rc-table is a foundational UI component for React applications, designed to provide comprehensive table functionalities without imposing specific styling. It serves as a highly customizable base for building complex data grid interfaces, allowing developers to integrate their own design systems. The current stable version is 7.55.1. The project demonstrates an active release cadence, frequently publishing patch and minor versions to address bugs and introduce new features. Key differentiators include its unopinionated nature regarding aesthetics, offering full control over presentation, while providing robust features such as fixed headers, expandable rows, virtual scrolling (since v1.9.0 of the underlying `@rc-component/table`), and a flexible API for columns and data manipulation.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to render a basic table with defined columns and data using rc-table in a React TypeScript environment, including type definitions.

import React from 'react';
import { createRoot } from 'react-dom/client';
import Table from 'rc-table';
import type { ColumnType } from 'rc-table';

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

const columns: ColumnType<DataType>[] = [
  {
    title: 'Name',
    dataIndex: 'name',
    key: 'name',
    width: 100,
  },
  {
    title: 'Age',
    dataIndex: 'age',
    key: 'age',
    width: 100,
  },
  {
    title: 'Address',
    dataIndex: 'address',
    key: 'address',
    width: 200,
  },
  {
    title: 'Operations',
    dataIndex: '',
    key: 'operations',
    render: () => <a href="#">Delete</a>,
  },
];

const data: DataType[] = [
  { name: 'Jack', age: 28, address: 'some where', key: '1' },
  { name: 'Rose', age: 36, address: 'some where', key: '2' },
];

function App() {
  return <Table<DataType> columns={columns} data={data} />; 
}

const container = document.getElementById('root');
if (container) {
  const root = createRoot(container);
  root.render(<App />);
} else {
  console.error('Root element not found');
}

view raw JSON →