> For AI agents: the complete documentation index is available at https://rickyshin93.github.io/tao-ui/llms.txt, the full documentation bundle is available at https://rickyshin93.github.io/tao-ui/llms-full.txt.

# Table

Data Display`@rockshin/tao-ui`

[Examples](#examples)[API](#api)

Displays structured row and column data with selection, sorting, filtering, and pagination hooks.

## When to use

Use Table for dense, comparable records that benefit from aligned columns.

**Recommended**

- Keep columns focused on the task.
- Use stable row keys.
- Control sorting and pagination when data is remote.
- Gate secondary columns with column.responsive (e.g. \['lg']) instead of hand-rolled media queries.

**Avoid**

- Do not use Table for card-like content where comparison is not important.

## Examples


### Basic usage
```tsx preview
import { Table } from '@rockshin/tao-ui';

const columns = [
  { key: 'name', dataIndex: 'name' as const, title: 'Name' },
  { key: 'role', dataIndex: 'role' as const, title: 'Role' },
];

const users = [
  { id: 1, name: 'Ada Lovelace', role: 'Engineer' },
  { id: 2, name: 'Grace Hopper', role: 'Scientist' },
];

function TableExample() {
  return (
    <Table
      columns={columns}
      dataSource={users}
      rowKey="id"
      pagination={false}
    />
  );
}

export default TableExample;
```

### Variants
```tsx preview
import { Stack, Table } from '@rockshin/tao-ui';

const columns = [
  { key: 'name', dataIndex: 'name' as const, title: 'Name' },
  { key: 'role', dataIndex: 'role' as const, title: 'Role' },
];

const data = [
  { id: 1, name: 'Ada', role: 'Engineer' },
  { id: 2, name: 'Grace', role: 'Scientist' },
];

function TableVariants() {
  return (
    <Stack gap="lg">
      <Table
        columns={columns}
        dataSource={data}
        rowKey="id"
        variant="filled"
        pagination={false}
      />
      <Table
        columns={columns}
        dataSource={data}
        rowKey="id"
        variant="outlined"
        pagination={false}
      />
      <Table
        columns={columns}
        dataSource={data}
        rowKey="id"
        variant="modern"
        pagination={false}
      />
      <Table
        columns={columns}
        dataSource={data}
        rowKey="id"
        variant="borderless"
        pagination={false}
      />
    </Stack>
  );
}

export default TableVariants;
```

### Sizes and borders
```tsx preview
import { Stack, Table } from '@rockshin/tao-ui';

const columns = [
  { key: 'name', dataIndex: 'name' as const, title: 'Name' },
  { key: 'status', dataIndex: 'status' as const, title: 'Status' },
];
const data = [{ id: 1, name: 'Build', status: 'Passing' }];

function TableSizes() {
  return (
    <Stack gap="lg">
      <Table
        size="small"
        columns={columns}
        dataSource={data}
        rowKey="id"
        pagination={false}
      />
      <Table
        size="medium"
        bordered
        columns={columns}
        dataSource={data}
        rowKey="id"
        pagination={false}
      />
      <Table
        size="large"
        columns={columns}
        dataSource={data}
        rowKey="id"
        pagination={false}
      />
    </Stack>
  );
}

export default TableSizes;
```

### Loading, empty, and pagination
```tsx preview
import { Stack, Table } from '@rockshin/tao-ui';

const columns = [{ key: 'name', dataIndex: 'name' as const, title: 'Name' }];

function TableStates() {
  return (
    <Stack gap="lg">
      <Table loading columns={columns} dataSource={[]} rowKey="id" />
      <Table
        columns={columns}
        dataSource={[]}
        rowKey="id"
        emptyText="No matching users."
        pagination={false}
      />
      <Table
        columns={columns}
        dataSource={Array.from({ length: 12 }, (_, index) => ({
          id: index,
          name: 'User ' + (index + 1),
        }))}
        rowKey="id"
        pagination={{ pageSize: 5 }}
      />
    </Stack>
  );
}

export default TableStates;
```

### Fixed header, expandable rows, and summary
`scroll.y` caps the body height and pins the header; `expandable` renders details under a row (the expand column sits before the selection column); `summary` returns `Table.Summary.Row` / `Table.Summary.Cell` footer rows — `Cell.index` counts from the expand/selection columns to sync fixed columns, and \`\` pins the footer while the body scrolls.
```tsx preview
import { Table } from '@rockshin/tao-ui';

const data = Array.from({ length: 30 }, (_, index) => ({
  id: index + 1,
  name: 'User ' + (index + 1),
  team: ['Design', 'Engineering', 'Sales'][index % 3],
  score: 60 + ((index * 7) % 40),
}));

const columns = [
  {
    key: 'name',
    dataIndex: 'name' as const,
    title: 'Name',
    width: 160,
    fixed: 'left' as const,
  },
  { key: 'team', dataIndex: 'team' as const, title: 'Team', width: 240 },
  {
    key: 'score',
    dataIndex: 'score' as const,
    title: 'Score',
    width: 120,
    align: 'right' as const,
  },
];

function TableAdvanced() {
  return (
    <Table
      columns={columns}
      dataSource={data}
      rowKey="id"
      pagination={false}
      scroll={{ x: 640, y: 280 }}
      expandable={{
        expandedRowRender: (record) =>
          record.name + ' works in ' + record.team + '.',
        rowExpandable: (record) => record.team !== 'Sales',
      }}
      summary={(pageData) => (
        <Table.Summary fixed>
          <Table.Summary.Row>
            <Table.Summary.Cell index={0} colSpan={3}>
              Total
            </Table.Summary.Cell>
            <Table.Summary.Cell index={3} align="right">
              {pageData.reduce((sum, record) => sum + record.score, 0)}
            </Table.Summary.Cell>
          </Table.Summary.Row>
        </Table.Summary>
      )}
    />
  );
}

export default TableAdvanced;
```

### Sorting
Configure sorting on columns and click a header to switch the sort direction.
```tsx preview
import { Table, type TableColumn } from '@rockshin/tao-ui';

interface User {
  id: number;
  name: string;
  age: number;
  email: string;
  role: string;
  department: string;
}

const users: User[] = Array.from({ length: 46 }, (_, i) => ({
  id: i + 1,
  name: ['Alice', 'Bob', 'Charlie', 'Diana', 'Eve', 'Frank', 'Grace', 'Hank'][
    i % 8
  ],
  age: 22 + (i % 20),
  email: `user${i + 1}@example.com`,
  role: i % 3 === 0 ? 'admin' : i % 3 === 1 ? 'editor' : 'viewer',
  department: ['Engineering', 'Design', 'Marketing', 'Sales'][i % 4],
}));

export default function TableSorting() {
  const columns: TableColumn<User>[] = [
    {
      key: 'name',
      dataIndex: 'name',
      title: 'Name',
      sorter: (a, b) => a.name.localeCompare(b.name),
    },
    {
      key: 'age',
      dataIndex: 'age',
      title: 'Age',
      sorter: (a, b) => a.age - b.age,
      defaultSortOrder: 'ascend',
    },
    { key: 'role', dataIndex: 'role', title: 'Role' },
  ];
  return <Table columns={columns} dataSource={users} rowKey="id" />;
}
```

### Column filtering
Provide filter choices and a predicate, then select items in the column menu.
```tsx preview
import { Table, type TableColumn } from '@rockshin/tao-ui';

interface User {
  id: number;
  name: string;
  age: number;
  email: string;
  role: string;
  department: string;
}

const users: User[] = Array.from({ length: 46 }, (_, i) => ({
  id: i + 1,
  name: ['Alice', 'Bob', 'Charlie', 'Diana', 'Eve', 'Frank', 'Grace', 'Hank'][
    i % 8
  ],
  age: 22 + (i % 20),
  email: `user${i + 1}@example.com`,
  role: i % 3 === 0 ? 'admin' : i % 3 === 1 ? 'editor' : 'viewer',
  department: ['Engineering', 'Design', 'Marketing', 'Sales'][i % 4],
}));

export default function TableFiltering() {
  const columns: TableColumn<User>[] = [
    { key: 'name', dataIndex: 'name', title: 'Name' },
    { key: 'age', dataIndex: 'age', title: 'Age' },
    {
      key: 'role',
      dataIndex: 'role',
      title: 'Role',
      filters: [
        { text: 'Admin', value: 'admin' },
        { text: 'Editor', value: 'editor' },
        { text: 'Viewer', value: 'viewer' },
      ],
      onFilter: (value, record) => record.role === value,
    },
    {
      key: 'department',
      dataIndex: 'department',
      title: 'Department',
      filters: [
        { text: 'Engineering', value: 'Engineering' },
        { text: 'Design', value: 'Design' },
        { text: 'Marketing', value: 'Marketing' },
        { text: 'Sales', value: 'Sales' },
      ],
      onFilter: (value, record) => record.department === value,
    },
  ];
  return <Table columns={columns} dataSource={users} rowKey="id" />;
}
```

### Controlled row selection
Use a stable record ID for `rowKey`, such as a database ID. Keep selected keys in `rowSelection.selectedRowKeys` and update them from `rowSelection.onChange`.
Return `{ disabled: true }` from `rowSelection.getCheckboxProps(record)` for rows that cannot be selected. The header checkbox applies to eligible rows on the current page and preserves selection on other pages. Since [0.0.49](https://rickyshin93.github.io/tao-ui/guide/changelog.md), Table also uses the current disabled state when rows change and the callback stays the same.
```tsx preview
import { Stack, Table, type TableColumn } from '@rockshin/tao-ui';

import { useState } from 'react';

interface User {
  id: number;
  name: string;
  age: number;
  email: string;
  role: string;
  department: string;
}

const users: User[] = Array.from({ length: 46 }, (_, i) => ({
  id: i + 1,
  name: ['Alice', 'Bob', 'Charlie', 'Diana', 'Eve', 'Frank', 'Grace', 'Hank'][
    i % 8
  ],
  age: 22 + (i % 20),
  email: `user${i + 1}@example.com`,
  role: i % 3 === 0 ? 'admin' : i % 3 === 1 ? 'editor' : 'viewer',
  department: ['Engineering', 'Design', 'Marketing', 'Sales'][i % 4],
}));

const baseColumns: TableColumn<User>[] = [
  { key: 'id', dataIndex: 'id', title: 'ID', width: 60, align: 'center' },
  { key: 'name', dataIndex: 'name', title: 'Name' },
  { key: 'age', dataIndex: 'age', title: 'Age', width: 80 },
  { key: 'email', dataIndex: 'email', title: 'Email' },
  { key: 'role', dataIndex: 'role', title: 'Role' },
];

export default function TableRowSelection() {
  function Demo() {
    const [selectedKeys, setSelectedKeys] = useState<React.Key[]>([]);
    return (
      <Stack gap="sm">
        <p style={{ fontSize: 13, color: 'var(--tao-color-text-secondary)' }}>
          Selected:{' '}
          {selectedKeys.length === 0 ? 'none' : selectedKeys.join(', ')}
        </p>
        <Table
          columns={baseColumns}
          dataSource={users}
          rowKey="id"
          rowSelection={{
            selectedRowKeys: selectedKeys,
            onChange: (keys) => setSelectedKeys(keys),
            getCheckboxProps: (record) => ({
              disabled: record.role === 'viewer',
            }),
          }}
        />
      </Stack>
    );
  }
  return <Demo />;
}
```

### Horizontal scrolling and fixed columns
Combine column widths with `scroll.x`; fixed columns preserve context while scrolling.
```tsx preview
import { Table, type TableColumn } from '@rockshin/tao-ui';

interface User {
  id: number;
  name: string;
  age: number;
  email: string;
  role: string;
  department: string;
}

const users: User[] = Array.from({ length: 46 }, (_, i) => ({
  id: i + 1,
  name: ['Alice', 'Bob', 'Charlie', 'Diana', 'Eve', 'Frank', 'Grace', 'Hank'][
    i % 8
  ],
  age: 22 + (i % 20),
  email: `user${i + 1}@example.com`,
  role: i % 3 === 0 ? 'admin' : i % 3 === 1 ? 'editor' : 'viewer',
  department: ['Engineering', 'Design', 'Marketing', 'Sales'][i % 4],
}));

export default function TableHorizontalScroll() {
  const columns: TableColumn<User>[] = [
    { key: 'id', dataIndex: 'id', title: 'ID', width: 80, fixed: 'left' },
    {
      key: 'name',
      dataIndex: 'name',
      title: 'Name',
      width: 150,
      fixed: 'left',
    },
    { key: 'age', dataIndex: 'age', title: 'Age', width: 100 },
    { key: 'email', dataIndex: 'email', title: 'Email', width: 250 },
    { key: 'role', dataIndex: 'role', title: 'Role', width: 120 },
    {
      key: 'department',
      dataIndex: 'department',
      title: 'Department',
      width: 150,
    },
    {
      key: 'actions',
      title: 'Actions',
      width: 120,
      fixed: 'right',
      render: () => (
        <button
          type="button"
          style={{
            padding: 0,
            border: 0,
            background: 'transparent',
            color: 'var(--tao-primary)',
            cursor: 'pointer',
          }}
        >
          Edit
        </button>
      ),
    },
  ];
  return (
    <div style={{ maxWidth: 600 }}>
      <Table
        columns={columns}
        dataSource={users.slice(0, 8)}
        rowKey="id"
        scroll={{ x: 1000 }}
        pagination={false}
      />
    </div>
  );
}
```

### Fixed header
`scroll.y` creates a bounded scrolling body while retaining the table header.
```tsx preview
import { Stack, Table, type TableColumn } from '@rockshin/tao-ui';

interface User {
  id: number;
  name: string;
  age: number;
  email: string;
  role: string;
  department: string;
}

const users: User[] = Array.from({ length: 46 }, (_, i) => ({
  id: i + 1,
  name: ['Alice', 'Bob', 'Charlie', 'Diana', 'Eve', 'Frank', 'Grace', 'Hank'][
    i % 8
  ],
  age: 22 + (i % 20),
  email: `user${i + 1}@example.com`,
  role: i % 3 === 0 ? 'admin' : i % 3 === 1 ? 'editor' : 'viewer',
  department: ['Engineering', 'Design', 'Marketing', 'Sales'][i % 4],
}));

export default function TableFixedHeader() {
  const columns: TableColumn<User>[] = [
    { key: 'id', dataIndex: 'id', title: 'ID', width: 80, fixed: 'left' },
    { key: 'name', dataIndex: 'name', title: 'Name', width: 150 },
    { key: 'age', dataIndex: 'age', title: 'Age', width: 100 },
    { key: 'email', dataIndex: 'email', title: 'Email', width: 250 },
    { key: 'role', dataIndex: 'role', title: 'Role', width: 120 },
    {
      key: 'department',
      dataIndex: 'department',
      title: 'Department',
      width: 150,
      fixed: 'right',
    },
  ];
  return (
    <Stack gap="lg" style={{ maxWidth: 640 }}>
      {(['modern', 'outlined', 'borderless'] as const).map((variant) => (
        <Table
          key={variant}
          variant={variant}
          columns={columns}
          dataSource={users}
          rowKey="id"
          scroll={{ x: 900, y: 240 }}
          pagination={false}
        />
      ))}
    </Stack>
  );
}
```

### Expandable rows
Expand a record for additional details instead of placing everything in columns.
```tsx preview
import { Table, type TableColumn } from '@rockshin/tao-ui';

interface User {
  id: number;
  name: string;
  age: number;
  email: string;
  role: string;
  department: string;
}

const users: User[] = Array.from({ length: 46 }, (_, i) => ({
  id: i + 1,
  name: ['Alice', 'Bob', 'Charlie', 'Diana', 'Eve', 'Frank', 'Grace', 'Hank'][
    i % 8
  ],
  age: 22 + (i % 20),
  email: `user${i + 1}@example.com`,
  role: i % 3 === 0 ? 'admin' : i % 3 === 1 ? 'editor' : 'viewer',
  department: ['Engineering', 'Design', 'Marketing', 'Sales'][i % 4],
}));

const baseColumns: TableColumn<User>[] = [
  { key: 'id', dataIndex: 'id', title: 'ID', width: 60, align: 'center' },
  { key: 'name', dataIndex: 'name', title: 'Name' },
  { key: 'age', dataIndex: 'age', title: 'Age', width: 80 },
  { key: 'email', dataIndex: 'email', title: 'Email' },
  { key: 'role', dataIndex: 'role', title: 'Role' },
];

export default function TableExpandable() {
  return (
    <Table
      columns={baseColumns}
      dataSource={users.slice(0, 6)}
      rowKey="id"
      rowSelection={{}}
      pagination={false}
      expandable={{
        expandedRowRender: (record) =>
          `${record.name} works in ${record.department} as ${record.role}.`,
        rowExpandable: (record) => record.role !== 'viewer',
        defaultExpandedRowKeys: [1],
      }}
    />
  );
}
```

### Expansion with scrolling
Combine expandable detail with a fixed body height and inspect scrolling and alignment.
```tsx preview
import { Table } from '@rockshin/tao-ui';

interface User {
  id: number;
  name: string;
  age: number;
  email: string;
  role: string;
  department: string;
}

const users: User[] = Array.from({ length: 46 }, (_, i) => ({
  id: i + 1,
  name: ['Alice', 'Bob', 'Charlie', 'Diana', 'Eve', 'Frank', 'Grace', 'Hank'][
    i % 8
  ],
  age: 22 + (i % 20),
  email: `user${i + 1}@example.com`,
  role: i % 3 === 0 ? 'admin' : i % 3 === 1 ? 'editor' : 'viewer',
  department: ['Engineering', 'Design', 'Marketing', 'Sales'][i % 4],
}));

export default function TableExpandableWithScroll() {
  return (
    <div style={{ maxWidth: 600 }}>
      <Table
        columns={[
          {
            key: 'name',
            dataIndex: 'name',
            title: 'Name',
            width: 140,
            fixed: 'left',
          },
          { key: 'email', dataIndex: 'email', title: 'Email', width: 260 },
          {
            key: 'department',
            dataIndex: 'department',
            title: 'Department',
            width: 200,
          },
          {
            key: 'role',
            dataIndex: 'role',
            title: 'Role',
            width: 120,
            fixed: 'right',
          },
        ]}
        dataSource={users.slice(0, 5)}
        rowKey="id"
        scroll={{ x: 900 }}
        pagination={false}
        expandable={{
          fixed: true,
          expandedRowRender: (record) =>
            `${record.name} works in ${record.department} as ${record.role}; this text stays inside the visible area while the table scrolls sideways.`,
          defaultExpandedRowKeys: [2],
        }}
      />
    </div>
  );
}
```

### Summary rows
Render totals with `Table.Summary` and align summary cells with table columns.
```tsx preview
import { Table } from '@rockshin/tao-ui';

interface User {
  id: number;
  name: string;
  age: number;
  email: string;
  role: string;
  department: string;
}

const users: User[] = Array.from({ length: 46 }, (_, i) => ({
  id: i + 1,
  name: ['Alice', 'Bob', 'Charlie', 'Diana', 'Eve', 'Frank', 'Grace', 'Hank'][
    i % 8
  ],
  age: 22 + (i % 20),
  email: `user${i + 1}@example.com`,
  role: i % 3 === 0 ? 'admin' : i % 3 === 1 ? 'editor' : 'viewer',
  department: ['Engineering', 'Design', 'Marketing', 'Sales'][i % 4],
}));

export default function TableSummary() {
  return (
    <div style={{ maxWidth: 640 }}>
      <Table
        columns={[
          {
            key: 'name',
            dataIndex: 'name',
            title: 'Name',
            width: 160,
            fixed: 'left',
          },
          {
            key: 'department',
            dataIndex: 'department',
            title: 'Department',
            width: 200,
          },
          { key: 'email', dataIndex: 'email', title: 'Email', width: 260 },
          {
            key: 'age',
            dataIndex: 'age',
            title: 'Age',
            width: 100,
            align: 'right',
            fixed: 'right',
          },
        ]}
        dataSource={users.slice(0, 20)}
        rowKey="id"
        scroll={{ x: 800, y: 300 }}
        pagination={false}
        summary={(pageData) => (
          <Table.Summary fixed>
            <Table.Summary.Row>
              <Table.Summary.Cell index={0}>Total</Table.Summary.Cell>
              <Table.Summary.Cell index={1} colSpan={2}>
                {pageData.length} people
              </Table.Summary.Cell>
              <Table.Summary.Cell index={3} align="right">
                {pageData.reduce((sum, user) => sum + user.age, 0)}
              </Table.Summary.Cell>
            </Table.Summary.Row>
          </Table.Summary>
        )}
      />
    </div>
  );
}
```

### Custom pagination
Control pagination in application state when working with server totals and page data.
```tsx preview
import { Table, type TableColumn } from '@rockshin/tao-ui';

interface User {
  id: number;
  name: string;
  age: number;
  email: string;
  role: string;
  department: string;
}

const users: User[] = Array.from({ length: 46 }, (_, i) => ({
  id: i + 1,
  name: ['Alice', 'Bob', 'Charlie', 'Diana', 'Eve', 'Frank', 'Grace', 'Hank'][
    i % 8
  ],
  age: 22 + (i % 20),
  email: `user${i + 1}@example.com`,
  role: i % 3 === 0 ? 'admin' : i % 3 === 1 ? 'editor' : 'viewer',
  department: ['Engineering', 'Design', 'Marketing', 'Sales'][i % 4],
}));

const baseColumns: TableColumn<User>[] = [
  { key: 'id', dataIndex: 'id', title: 'ID', width: 60, align: 'center' },
  { key: 'name', dataIndex: 'name', title: 'Name' },
  { key: 'age', dataIndex: 'age', title: 'Age', width: 80 },
  { key: 'email', dataIndex: 'email', title: 'Email' },
  { key: 'role', dataIndex: 'role', title: 'Role' },
];

export default function TableCustomPagination() {
  return (
    <Table
      columns={baseColumns}
      dataSource={users}
      rowKey="id"
      pagination={{
        pageSize: 5,
        showSizeChanger: true,
        showTotal: (total, [s, e]) => `${s}-${e} of ${total} users`,
      }}
    />
  );
}
```

### Combined features
Combine sorting, filtering, and selection and observe how they affect the current data.
```tsx preview
import { Table, type TableColumn } from '@rockshin/tao-ui';

import { useState } from 'react';

interface User {
  id: number;
  name: string;
  age: number;
  email: string;
  role: string;
  department: string;
}

const users: User[] = Array.from({ length: 46 }, (_, i) => ({
  id: i + 1,
  name: ['Alice', 'Bob', 'Charlie', 'Diana', 'Eve', 'Frank', 'Grace', 'Hank'][
    i % 8
  ],
  age: 22 + (i % 20),
  email: `user${i + 1}@example.com`,
  role: i % 3 === 0 ? 'admin' : i % 3 === 1 ? 'editor' : 'viewer',
  department: ['Engineering', 'Design', 'Marketing', 'Sales'][i % 4],
}));

export default function TableFullFeature() {
  function Demo() {
    const [selectedKeys, setSelectedKeys] = useState<React.Key[]>([]);
    const columns: TableColumn<User>[] = [
      {
        key: 'id',
        dataIndex: 'id',
        title: 'ID',
        width: 60,
        align: 'center',
        fixed: 'left',
      },
      {
        key: 'name',
        dataIndex: 'name',
        title: 'Name',
        width: 120,
        fixed: 'left',
        sorter: (a, b) => a.name.localeCompare(b.name),
      },
      {
        key: 'age',
        dataIndex: 'age',
        title: 'Age',
        width: 80,
        sorter: (a, b) => a.age - b.age,
      },
      {
        key: 'email',
        dataIndex: 'email',
        title: 'Email',
        width: 220,
        ellipsis: true,
      },
      {
        key: 'role',
        dataIndex: 'role',
        title: 'Role',
        width: 120,
        filters: [
          { text: 'Admin', value: 'admin' },
          { text: 'Editor', value: 'editor' },
          { text: 'Viewer', value: 'viewer' },
        ],
        onFilter: (value, record) => record.role === value,
      },
      {
        key: 'department',
        dataIndex: 'department',
        title: 'Dept',
        width: 140,
        filters: [
          { text: 'Engineering', value: 'Engineering' },
          { text: 'Design', value: 'Design' },
          { text: 'Marketing', value: 'Marketing' },
          { text: 'Sales', value: 'Sales' },
        ],
        onFilter: (value, record) => record.department === value,
      },
      {
        key: 'actions',
        title: 'Actions',
        width: 100,
        fixed: 'right',
        render: () => (
          <button
            type="button"
            style={{
              padding: 0,
              border: 0,
              background: 'transparent',
              color: 'var(--tao-primary)',
              cursor: 'pointer',
            }}
          >
            Edit
          </button>
        ),
      },
    ];
    return (
      <div style={{ maxWidth: 700 }}>
        <Table
          columns={columns}
          dataSource={users}
          rowKey="id"
          scroll={{ x: 1000 }}
          bordered
          rowSelection={{
            selectedRowKeys: selectedKeys,
            onChange: (keys) => setSelectedKeys(keys),
            fixed: true,
          }}
          pagination={{
            pageSize: 10,
            showSizeChanger: true,
            showTotal: (total) => `${total} users`,
          }}
        />
      </div>
    );
  }
  return <Demo />;
}
```

### Responsive columns
Use responsive column settings on smaller screens while retaining identifying fields.
```tsx preview="iframe-follow"
import { Table } from '@rockshin/tao-ui';

interface User {
  id: number;
  name: string;
  age: number;
  email: string;
  role: string;
  department: string;
}

const users: User[] = Array.from({ length: 46 }, (_, i) => ({
  id: i + 1,
  name: ['Alice', 'Bob', 'Charlie', 'Diana', 'Eve', 'Frank', 'Grace', 'Hank'][
    i % 8
  ],
  age: 22 + (i % 20),
  email: `user${i + 1}@example.com`,
  role: i % 3 === 0 ? 'admin' : i % 3 === 1 ? 'editor' : 'viewer',
  department: ['Engineering', 'Design', 'Marketing', 'Sales'][i % 4],
}));

export default function TableResponsiveColumns() {
  return (
    <Table
      columns={[
        { key: 'name', dataIndex: 'name', title: 'Name' },
        {
          key: 'email',
          dataIndex: 'email',
          title: 'Email',
          responsive: ['md'],
        },
        {
          key: 'department',
          dataIndex: 'department',
          title: 'Department',
          responsive: ['lg'],
        },
      ]}
      dataSource={users.slice(0, 5)}
      rowKey="id"
      pagination={false}
    />
  );
}
```

## API


### [#](#table)Table



| Property | Description | Type | Default Value |
| --- | --- | --- | --- |
| scroll | `y` caps the body height and keeps the header pinned while it scrolls. | `{ x?: string | number | undefined; y?: string | number | undefined; } | undefined` | `-` |
| summary | Footer rows built from `Table.Summary.Row` / `Table.Summary.Cell`. | `((pageData: T[]) => ReactNode) | undefined` | `-` |
| className | Additional css class | `string | undefined` | `-` |
| style | Additional style | `CSSProperties | undefined` | `-` |



### [#](#tablesummary)Table.Summary



| Property | Description | Type | Default Value |
| --- | --- | --- | --- |
| fixed | Pin the summary to the bottom while the body scrolls (needs `scroll.y`). | `boolean | undefined` | `-` |

