https://github.com/kavience/react-table
a react table component: https://kavience.github.io/react-table/
https://github.com/kavience/react-table
react react-table
Last synced: 9 days ago
JSON representation
a react table component: https://kavience.github.io/react-table/
- Host: GitHub
- URL: https://github.com/kavience/react-table
- Owner: kavience
- Created: 2021-12-16T04:18:15.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-12-17T04:05:34.000Z (about 4 years ago)
- Last Synced: 2025-10-14T19:53:06.520Z (3 months ago)
- Topics: react, react-table
- Language: TypeScript
- Homepage:
- Size: 1.32 MB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
React Table Component
## Introduction
A react table UI component.
## Demo
[View Demo](https://kavience.github.io/react-table/)
## Usage
```
npm install @kavience/react-table
```
Easy use
```ts
import React from 'react';
import ReactTable from '@kavience/react-table';
const columns: any[] = [
{
title: '姓名',
align: 'center',
width: 120,
ellipsis: true,
dataIndex: 'name'
},
{
title: '年龄',
dataIndex: 'age'
},
{
title: '身高',
dataIndex: 'height'
},
{
title: '体重',
dataIndex: 'weight'
}
];
const EasyUse = () => {
const dataSource = [
{
id: 1,
name:
'kevinkevinkevinkevinkevikevinkevinkevinkevinkevinkevinkevinkevinkevinkevinn',
age: 28,
height: '168cm',
weight: '75kg'
},
{
id: 2,
name: 'kevin2',
age: 28,
height: '168cm',
weight: '75kg'
},
{
id: 3,
name: 'kevin3',
age: 28,
height: '168cm',
weight: '75kg'
}
];
return (
Use React Table Simply
);
};
export default EasyUse;
```
## Api
### Table
| Property | Description | Type | Default | Version |
| :--------- | :----------------- | :------------------------------------------------------ | :------- | :------ |
| columns | Table coulmns | Column[] | [] | 0.0.1 |
| dataSource | Table data source | any[] | [] | 0.0.1 |
| bordered | Show border or not | boolean | false | 0.0.1 |
| rowKey | Row's unique key | string | 'key' | 0.0.1 |
| size | Table size | 'mini' \| 'small' \| 'middle' \| 'large' | 'middle' | 0.0.1 |
| header | Table header | any | | 0.0.1 |
| footer | Table footer | any | | 0.0.1 |
| pagination | Pagination | PaginationProps | | 0.0.1 |
| locale | Language locale | ReactTableLocal | | 0.0.1 |
| onChange | Table change | (pagination?: any, filters?: any, sorter?: any) => any; | | 0.0.1 |
### Column
| Property | Description | Type | Default | Version |
| :-------- | :----------------------------------------------------------------------------------- | :--------------------------------------------------------- | :------ | :------ |
| key | Unique key of this column, you can ignore this prop if you've set a unique dataIndex | string | | 0.0.1 |
| dataIndex | Display field of the data record | string | | 0.0.1 |
| title | Column title | string | | 0.0.1 |
| align | The specify which way that column is aligned | \'left' \| 'right' \| 'center' | | 0.0.1 |
| width | Table Width | number \| string | | 0.0.1 |
| ellipsis | The ellipsis cell content, not working with sorter and filters for now. | boolean | false | 0.0.1 |
| hidden | Hidden this column | boolean | false | 0.0.1 |
| className | Column class | string | | 0.0.1 |
| onFilter | Column on filter | (value: string, record: any) => boolean; | | 0.0.1 |
| sorter | Column Sorter | ((firstRecord: any, secondRecord: any) => any) \| boolean; | | 0.0.1 |
## Thanks
- rc-checkbox
- rc-dropdown
- rc-pagination
- rc-select
- rc-switch
- [willow-component-tools](https://github.com/kavience/willow-component-tool)