Installations
npm install rc-table
Developer Guide
Typescript
Yes
Module System
CommonJS
Min. Node Version
>=8.x
Node Version
22.5.1
NPM Version
10.8.2
Score
90.1
Supply Chain
95.6
Quality
95.8
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Languages
TypeScript (64.17%)
JavaScript (33.32%)
Less (2.5%)
Developer
Download Statistics
Total Downloads
239,919,463
Last Day
247,411
Last Week
1,154,272
Last Month
5,511,049
Last Year
66,955,382
GitHub Statistics
1,315 Stars
1,297 Commits
594 Forks
45 Watching
35 Branches
124 Contributors
Bundle Size
82.70 kB
Minified
27.38 kB
Minified + Gzipped
Package Meta Information
Latest Version
7.50.2
Package Id
rc-table@7.50.2
Unpacked Size
394.67 kB
Size
61.29 kB
File Count
200
NPM Version
10.8.2
Node Version
22.5.1
Publised On
08 Jan 2025
Total Downloads
Cumulative downloads
Total Downloads
239,919,463
Last day
-14.5%
247,411
Compared to previous day
Last week
-21.7%
1,154,272
Compared to previous week
Last month
-1.8%
5,511,049
Compared to previous month
Last year
17.7%
66,955,382
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
45
rc-table
React table component with useful functions.
install
Development
npm install
npm start
Example
https://table-react-component.vercel.app/
Usage
1import Table from 'rc-table'; 2 3const columns = [ 4 { 5 title: 'Name', 6 dataIndex: 'name', 7 key: 'name', 8 width: 100, 9 }, 10 { 11 title: 'Age', 12 dataIndex: 'age', 13 key: 'age', 14 width: 100, 15 }, 16 { 17 title: 'Address', 18 dataIndex: 'address', 19 key: 'address', 20 width: 200, 21 }, 22 { 23 title: 'Operations', 24 dataIndex: '', 25 key: 'operations', 26 render: () => <a href="#">Delete</a>, 27 }, 28]; 29 30const data = [ 31 { name: 'Jack', age: 28, address: 'some where', key: '1' }, 32 { name: 'Rose', age: 36, address: 'some where', key: '2' }, 33]; 34 35React.render(<Table columns={columns} data={data} />, mountNode);
API
Properties
Name | Type | Default | Description |
---|---|---|---|
tableLayout | auto | fixed | auto | fixed for any columns is fixed or ellipsis or header is fixed | https://developer.mozilla.org/en-US/docs/Web/CSS/table-layout |
prefixCls | String | rc-table | |
className | String | additional className | |
id | String | identifier of the container div | |
useFixedHeader | Boolean | false | whether use separator table for header. better set width for columns |
scroll | Object | {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 |
expandable | Object | Config expand props | |
expandable.defaultExpandAllRows | Boolean | false | Expand All Rows initially |
expandable.defaultExpandedRowKeys | String[] | [] | initial expanded rows keys |
expandable.expandedRowKeys | String[] | current expanded rows keys | |
expandable.expandedRowRender | Function(recode, index, indent, expanded):ReactNode | Content render to expanded row | |
expandable.expandedRowClassName | string | (recode, index, indent) => string | get expanded row's className | |
expandable.expandRowByClick | boolean | Support expand by click row | |
expandable.expandIconColumnIndex | Number | 0 | The index of expandIcon which column will be inserted when expandIconAsCell is false |
expandable.expandIcon | props => ReactNode | Customize expand icon | |
expandable.indentSize | Number | 15 | indentSize for every level of data.i.children, better using with column.width specified |
expandable.rowExpandable | (record) => boolean | Config row support expandable | |
expandable.onExpand | Function(expanded, record) | function to call when click expand icon | |
expandable.onExpandedRowsChange | Function(expandedRows) | function to call when the expanded rows change | |
expandable.fixed | String | Boolean | - | this expand icon will be fixed when table scroll horizontally: true or left or right and expandIconColumnIndex need to stay first or last |
rowKey | string 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. |
rowClassName | string or Function(record, index, indent):string | get row's className | |
rowRef | Function(record, index, indent):string | get row's ref key | |
data | Object[] | data record array to be rendered | |
onRow | Function(record, index) | Set custom props per each row. | |
onHeaderRow | Function(record, index) | Set custom props per each header row. | |
showHeader | Boolean | true | whether table head is shown |
hidden | Boolean | false | Hidden column. |
title | Function(currentData) | table title render function | |
footer | Function(currentData) | table footer render function | |
emptyText | React.Node or Function | No Data | Display text when data is empty |
columns | Object[] | The columns config of table, see table below | |
components | Object | Override table elements, see #171 for more details | |
sticky | boolean | {offsetHeader?: number, offsetScroll?: number, getContainer?: () => Window | HTMLElement } | false | stick header and scroll bar |
summary | (data: readonly RecordType[]) => React.ReactNode | - | summary attribute in table component is used to define the summary row. |
rowHoverable | boolean | true | Table hover interaction |
Column Props
Name | Type | Default | Description |
---|---|---|---|
key | String | key of this column | |
className | String | className of this column | |
colSpan | Number | thead colSpan of this column | |
title | React Node | title of this column | |
dataIndex | String | display field of the data record | |
width | String | Number | width of the specific proportion calculation according to the width of the columns | |
minWidth | Number | the minimum width of the column, only worked when tableLayout is auto | |
fixed | String | Boolean | this column will be fixed when table scroll horizontally: true or 'left' or 'right' | |
align | String | specify how cell content is aligned | |
ellipsis | Boolean | specify whether cell content be ellipsized | |
rowScope | 'row' | 'rowgroup' | Set scope attribute for all cells in this column | |
onCell | Function(record, index) | Set custom props per each cell. | |
onHeaderCell | Function(record) | Set custom props per each header cell. | |
render | Function(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
Name | Type | Default | Description |
---|---|---|---|
key | String | key of this summary | |
fixed | boolean | '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
Name | Type | Default | Description |
---|---|---|---|
key | String | key of this summary | |
className | String | - | className of this summary row |
style | React.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. |
License
rc-table is released under the MIT license.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
17 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE.md:0
- Info: FSF or OSI recognized license: MIT License: LICENSE.md:0
Reason
0 existing vulnerabilities detected
Reason
SAST tool detected but not run on all commits
Details
- Info: SAST configuration detected: CodeQL
- Warn: 11 commits out of 19 are checked with a SAST tool
Reason
Found 10/25 approved changesets -- score normalized to 4
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql.yml:16
- Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql.yml:17
- Warn: no topLevel permission defined: .github/workflows/codeql.yml:1
- Warn: no topLevel permission defined: .github/workflows/issue-reply.yml:1
- Warn: no topLevel permission defined: .github/workflows/main.yml:1
- Info: no jobLevel write permissions found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/react-component/table/codeql.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/react-component/table/codeql.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/react-component/table/codeql.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/react-component/table/codeql.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/issue-reply.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/react-component/table/issue-reply.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/issue-reply.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/react-component/table/issue-reply.yml/master?enable=pin
- Info: 0 out of 4 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 2 third-party GitHubAction dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Score
5.2
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More