Table

Storybook

A table displays rows of data.

Import

import { Table } from 'rsuite';
  • <Table> Table component
  • <Table.Column> Table definition column component
  • <Table.ColumnGroup> Used for column header grouping
  • <Table.HeaderCell> Column Header cell component
  • <Table.Cell> Cell component

Examples

Basic

Id
First Name
Last Name
Gender
Age
Postcode
Email
...
1
Lacy
Stark
male
30
53136-0600
Fanny51@gmail.com
2
Brionna
Gorczany
male
33
96081-3397
Megane.Kirlin@hotmail.com
3
Zackary
Watsica
female
34
66636
Patricia.Nader@gmail.com
4
Elyssa
Wintheiser
female
36
33841
Amelia_Lowe5@yahoo.com
5
Gunnar
Bosco
male
20
03730
Dallin7@hotmail.com
6
Manuel
Goyette
male
42
37947-5061
Colby_Stark@gmail.com
7
Kristofer
Gleason
male
41
60564-1698
Alayna_Morar86@hotmail.com
8
Samson
Beahan
female
37
04710-2453
Dustin_Murazik36@gmail.com
9
Ayden
Grady
female
27
97978-2972
Kirk.Franey31@hotmail.com
10
Ottis
Schoen
female
42
71284-9070
Marlen_Schmidt@yahoo.com
11
Brenden
Kunze
male
47
59528
Ciara_Streich@gmail.com
12
Malcolm
Friesen
female
23
31861
Shanny0@yahoo.com
13
Angelica
Bartell
female
20
74666
Sheldon.Beatty39@yahoo.com
14
Eldon
Spinka
female
33
20184-2911
Urban.Metz@gmail.com
15
Myrna
Toy
male
47
97499-0198
Hollis98@yahoo.com
16
Ayana
Toy
female
23
84317-4831
Keon_Collier6@gmail.com
17
Margret
Torphy
female
24
10010
Estrella_Marks43@gmail.com
18
Claud
Russel
female
43
21052-4633
Cindy_Dooley@gmail.com
19
Corine
Legros
male
47
10784-1438
Stella_Hettinger50@gmail.com
20
Jerrell
Pagac
male
30
62843
Ottis_Bosco18@yahoo.com
Loading...

Appearance

Compact:Bordered:Show Header:Hover:
Loading:No data:Auto Height:Fill Height:

Columns:
Id
First Name
Last Name
Gender
City

Id
First Name
Last Name
Gender
City
1
Julianne
Veum
female
East Martine
2
Boris
Homenick
female
Port Claudinechester
3
Tiana
Kerluke
male
Lake Dorrisshire
4
Esta
Witting
male
Sethhaven
5
Coby
Hackett
male
Hyattton
6
Patsy
Jerde-Hahn
male
Alland
7
Ulises
Hand
male
Cristbury
8
Jaclyn
Balistreri
male
Alysonfurt
9
Jonathon
Mraz
female
Harrisshire
10
Alvena
Swift
male
Lynwood
Loading...
  • autoHeight: The height of the table will be automatically expanded according to the number of data rows, and no vertical scroll bar will appear.
  • fillHeight: Force the height of the table to be equal to the height of its parent container. Cannot be used together with autoHeight.

Virtualized

Support virtualized, effectively render large tabular data.

Id
First Name
Last Name
Gender
Age
City
Email
1
Bennett
Conroy
female
47
West Durwardland
Deon.Kovacek@yahoo.com
2
Coy
Keebler
male
47
Lake Hanna
Marilou77@hotmail.com
3
Ransom
Legros
female
44
North Madelynn
Monica81@yahoo.com
4
Itzel
Auer-Ullrich
male
36
Hermannview
Yasmin.Nolan13@yahoo.com
5
General
Mueller
female
45
Sandystead
Jerrell_Romaguera@yahoo.com
6
Dannie
Hintz
female
31
Botsfordland
Jordy86@gmail.com
7
Kenya
Friesen
female
35
East Timmothycester
Natalie.Glover@yahoo.com
8
Marianne
Parker
male
24
South Wardside
Lavon56@hotmail.com
9
Gabriel
Wilderman
male
41
North Rowland
Vladimir37@gmail.com
10
Claire
Runolfsson
male
40
Hammesfield
Eloisa_Pouros@hotmail.com
11
Kole
Fahey
female
32
Marlenecester
Dagmar_Schowalter63@hotmail.com
12
Dakota
Price
male
21
Port Jaymechester
Joan22@yahoo.com
13
Brisa
Wiza
male
24
Ornmouth
Louvenia73@hotmail.com
Loading...

Custom Cell

Avartar
Name
Skill Proficiency
Rating
Income
⭐️⭐️⭐️⭐️
$9093.00
⭐️⭐️
$21064.33
⭐️⭐️
$1979.14
⭐️⭐️⭐️
$79477.25
⭐️⭐️
$62458.21
⭐️⭐️⭐️⭐️
$68560.25
⭐️⭐️⭐️
$6375.00
⭐️⭐️
$71178.41
Loading...

Depending on your business scenario, you can define what you want to display in a cell, such as displaying a picture, like adding a few buttons, or displaying a text box that you can customize, and simply redefining the Cell component.

For example, display a picture, define a Imagecell component:

const ImageCell = ({ rowData, dataKey, ...props }) => (
  <Cell {...props}>
    <img src={rowData[dataKey]} width="50" />
  </Cell>
);

Use:

<Column width="{200}">
  <HeaderCell>Avartar</HeaderCell>
  <ImageCell dataKey="avartar" />
</Column>

The children property support function on <Cell> can get rowData to return a new children.

Use:

<Column width="{200}">
  <HeaderCell>Date</HeaderCell>
  <Cell>{rowData => rowData.date.toLocaleString()}</Cell>
</Column>

Custom row height

If you need to define row heights based on the content of your data in practical applications, you can use the following methods:

return (
  <Table
    rowHeight={rowData => {
      if (rowData?.tags.length > 4) {
        return 80;
      }
      return 40;
    }}
  >
    ...
  </Table>
);

Resizable

Id
First Name
Last Name
City
Email
1
Rory
O'Hara-Gislason
Funkhaven
Eliezer_Schinner@hotmail.com
2
Nona
Rodriguez
Fort Blaise
Jannie.Kirlin91@hotmail.com
3
Kendrick
Kuvalis-Baumbach
Glovermouth
Myrtice_West86@gmail.com
4
Jude
Heidenreich
Fort Jaden
Moses_Roberts@hotmail.com
5
Tito
Gleason
Lake Ridge
Jerrell_Hessel@gmail.com
6
Vicky
Powlowski
Palm Coast
Vern76@gmail.com
7
Ava
Anderson
Lake Dakota
Waino_Ebert@hotmail.com
8
Nyasia
Mosciski
North Lorenza
Gregorio.Bogisich69@yahoo.com
Loading...

Move the mouse to the column split line, will display a blue move handle, click Not to loosen and drag left and right to adjust the width of the column.

To support this feature, you need to set a resizable attribute in Column.

Fluid

Id
Name flexGrow=2
City flexGrow=1
Email
1
Angel Konopelski
Klington
Clementina_Weissnat@gmail.com
2
Dr. Susanna Thompson-Ernser
New Adellaview
Laila.Dach43@gmail.com
3
Kenneth Rohan-Kozey
North Garryville
Scotty.Bruen@hotmail.com
4
Harley Harris
Port Sierrastad
Sidney_Borer@yahoo.com
5
Miss William Harvey
Downers Grove
Etha.Upton20@gmail.com
6
Soledad Waelchi
Turnerfort
Darrin.Heaney16@gmail.com
7
Kari Zboncak
Georgetown
Leonardo_Walter5@gmail.com
8
June Hoeger
Parkerside
Kayla.Kunde@yahoo.com
Loading...

If you need to set a column to automatic width, you need to configure the flexGrow property. flexGrow is a number type. Will fill the Table remaining width according to the sum of all flexGrow.

Note: After setting flexGrow, you cannot set the width and resizable properties. You can set a minimum width by minwidth.

<Column flexGrow="{1}">
  <HeaderCell>City <code>flexGrow={1}</code></HeaderCell>
  <Cell dataKey="city" />
</Column>

<Column flexGrow="{2}">
  <HeaderCell>Company Name <code>flexGrow={2}</code></HeaderCell>
  <Cell dataKey="companyName" />
</Column>

...

Sort

Id
Name
Gender
Age
Email
1
Marshall Mraz
male
35
Fanny_Stark74@hotmail.com
2
Dessie Bailey
male
28
Alysa_Tremblay29@hotmail.com
3
King Adams
female
35
Glenna38@yahoo.com
4
Dr. Alvena Effertz
female
30
Chet_Schuppe@yahoo.com
5
Karlie Adams
female
35
Lilian_Shields21@yahoo.com
6
Elta Kulas
male
22
Ella.Smith73@gmail.com
7
Allison Jerde-Waelchi
male
35
Kathryne49@yahoo.com
8
Keanu Kirlin
female
19
Camille.Steuber@hotmail.com
Loading...

Set a sortable attribute in the column <Column> that you want to sort.

While the <Table> defines a onSortColumn callback function, clicking the column header to sort the icon triggers the method and returns sortColumn and sortType.

<Table onSortColumn={(sortColumn, sortType) => { console.log(sortColumn, sortType); }} >

<Column width="{50}" sortable>
  <HeaderCell>Id</HeaderCell>
  <Cell dataKey="id" />
</Column>

<Column width="{130}" sortable>
  <HeaderCell>First Name</HeaderCell>
  <Cell dataKey="firstName" />
</Column>

...

Pagination

If you need table data paging, you must first filter the data paging (usually supported by the server data api), and then combine with the Pagination component to achieve table paging.

Id
First Name
Last Name
City
Email
1
Eudora
Heidenreich
North Hunterside
Jeanette95@hotmail.com
2
Mark
Sawayn
Marquardtberg
Carolina_Welch75@yahoo.com
3
Omari
Waters
Schillerstad
Roxane_Harris99@hotmail.com
4
Jerad
Langosh
South Willy
Kelsie.Ullrich@gmail.com
5
Uriel
Hilpert
Dahliabury
Henderson_DuBuque34@gmail.com
6
Kaitlin
Wuckert
Noblesville
Nia_Russel@hotmail.com
7
Mireya
Brakus
Collinsworth
Edmund_Wintheiser28@gmail.com
8
Elwyn
Hayes
Port Sageport
Wilhelmine52@yahoo.com
9
Virgil
Mayert
Port Reinhold
Jessica_Kerluke@yahoo.com
10
Dejah
Denesik
Providencifurt
Vincenza.Kling@yahoo.com
Loading...
Total Rows: 100
Go to

Tree

Vehicle 🚗
Rating ⭐️
Price 💰
Chevrolet
⭐️⭐️⭐️
$57032
Diesel
⭐️⭐️
$77855
Mini LeBaron
⭐️⭐️
$470799
Cadillac Explorer
⭐️⭐️
$119321
Bugatti Sentra
⭐️⭐️⭐️
$116420
Gasoline
⭐️⭐️⭐️
$534171
Chrysler F-150
⭐️⭐️
$886031
Smart Model S
⭐️⭐️⭐️
$138671
Mini Aventador
⭐️⭐️
$500214
Gasoline
⭐️⭐️⭐️⭐️
$468583
BMW A8
⭐️⭐️⭐️⭐️
$548016
Toyota Sentra
⭐️⭐️⭐️
$770147
Mazda Fortwo
⭐️⭐️⭐️
$119793
Nissan
⭐️⭐️⭐️⭐️⭐️
$581318
Diesel
⭐️⭐️⭐️⭐️
$432406
Ford 911
⭐️⭐️⭐️⭐️
$607962
Ferrari Mercielago
⭐️⭐️⭐️
$19220
Nissan Durango
⭐️⭐️
$713870
Diesel
⭐️⭐️⭐️
$228476
Mercedes Benz Charger
⭐️⭐️⭐️⭐️
$65356
Ferrari 911
⭐️⭐️
$36175
Lamborghini Model X
⭐️⭐️
$542652
Electric
⭐️⭐️⭐️⭐️
$361172
Chrysler CX-9
⭐️⭐️
$204957
Mercedes Benz Spyder
⭐️⭐️⭐️
$591679
Porsche Escalade
⭐️⭐️⭐️⭐️
$677890
Loading...

A tree table, primarily to show structured data, requires a isTree attribute to be set on the Table component, while the data is used to define the relational structure through children.

const data = [
  {
    id: '1',
    labelName: 'Car',
    status: 'ENABLED',
    children: [
      {
        id: '1-1',
        labelName: 'Mercedes Benz',
        status: 'ENABLED',
        count: 460
      }
    ]
  }
];
<Table data={data} isTree rowKey="id" />;

Dealing with related properties for a tree table

  • defaultExpandAllRows:boolean :Expand all nodes By default
  • expandedRowKeys (controlled) and defaultExpandedRowKeys are used to configure the rows that need to be expanded. Note that the parameters that these two properties receive are an array of Rowkey in the array.。
  • rowKey: Give each row of data to a unique key, corresponding to a unique value in the key. (You can set the rowKey in <Table>, the default value is key)
  • renderTreeToggle:() => ReactNode : Custom Toggle
  • onExpandChange:(expanded:boolean,rowData:object) => void: To open/close a node's callback function.
  • treeCol is an attribute on <Table.Column>, you can specify that the column is displayed as a tree.

When customizing the cell, it should be noted that if it is a tree table, then rowData needs to be passed to the Cell of the rendering tree, because it will be used inside the Cell to record the state of the node. #issue/2666

const CustomCell = ({ rowData, ...rest }) => {
  return (
    <Cell rowData={rowData} {...rest}>
      {rowData.name}
    </Cell>
  );
};

Expandable

#
First Name
Last Name
Gender
Age
City
Donnie
Senger
female
40
Turnerfield
Vernon
Orn
male
20
Port Piperberg
Doris
Treutel
male
39
East Maiaborough
Abelardo
Haag
male
30
Port Cortneyshire
Hoyt
Gorczany
female
21
Port Osbaldofurt
Loading...

To implement a Table that can be expanded, a combination of the following attributes is required.

Step 1: Set properties for Table

  • renderRowExpanded(rowData) => ReactNode: Used to return content that needs to be rendered in the expansion panel
  • rowExpandedHeight: Sets the height of the expandable area. The default is 100
  • expandedRowKeys (controlled) and defaultExpandedRowKeys are used to configure the rows that need to be expanded. Note that the parameters that these two properties receive are an array of Rowkey in the array.。
  • rowKey: Give each row of data to a unique key, corresponding to a unique value in the key.

Step 2:Custom Cell

Customize a Cell and put a button inside to manipulate the value in expandedRowKeys.

Editable

First Name
Last Name
Email
...
Donald
Schiller
Ethel_Powlowski35@hotmail.com
Naomi
Ritchie
Ewell_Feest67@yahoo.com
Chadd
Adams
Micaela_Batz7@yahoo.com
Loyce
Steuber
Hyman.Bernhard@gmail.com
Jamaal
Von
Susie.Luettgen6@yahoo.com
Tate
Rodriguez
Boyd.Fritsch52@yahoo.com
Leola
Murphy
Ursula.Waelchi45@gmail.com
Zane
Schoen
Andreane31@gmail.com
Loading...

Editable tables, just customize a Cell on the line

export const EditCell = ({ rowData, dataKey, onChange, ...props }) => {
  return (
    <Cell {...props}>
      {rowData.status === 'EDIT' ? (
        <input
          className="input"
          defaultValue={rowData[dataKey]}
          onChange={event => {
            onChange && onChange(rowData.id, dataKey, event.target.value);
          }}
        />
      ) : (
        rowData[dataKey]
      )}
    </Cell>
  );
};

Colspan

Id
Name
First Name
Last Name
Address
Company Name
1
Ernest Schuppe Anderson
New Gust
Lebsack - Nicolas
2
Janis
Bode
New Gust
Glover - Hermiston
3
Makenzie Vandervort
New Gust
Williamson - Kassulke
4
Ciara
Towne
Vandervort
Hilpert, Eichmann and Brown
5
Suzanne
Wolff
Vandervort
Mayer - Considine
6
Alessandra
Vandervort
Nikolaus and Sons
7
Margret
Heller
Vandervort
Corwin, Maggio and Wintheiser
8
Emiliano
Moore
Gilberthaven
Gulgowski - Botsford
9
Alessandra
Smith
Gilberthaven
Maggio LLC
Loading...

In some cases, you need to merge the relationships between columns to organize your data, and you can set a ColSpan attribute on the <Column> component,and set the header grouping through<ColumnGroup>. for example:

<ColumnGroup header="Name">
  <Column width={130} colSpan={2}>
    <HeaderCell>First Name</HeaderCell>
    <Cell dataKey="firstName" />
  </Column>

  <Column width={130}>
    <HeaderCell>Last Name</HeaderCell>
    <Cell dataKey="lastName" />
  </Column>
</ColumnGroup>

When lastName corresponds to a column value of null or undefined, it is merged by the firstName column.

Rowspan

Id
City
Street
First Name
Last Name
Company Name
...
1
New Gust
Dickinson Keys
Ernest Schuppe Anderson
Lebsack - Nicolas
Edit
2
Janis
Bode
Glover - Hermiston
Edit
3
Legros Divide
Makenzie Vandervort
Williamson - Kassulke
Edit
4
Vandervort
Mosciski Estate
Ciara
Towne
Hilpert, Eichmann and Brown
Edit
5
Suzanne
Wolff
Mayer - Considine
Edit
6
Kali Spurs
Alessandra
Nikolaus and Sons
Edit
7
Margret
Heller
Corwin, Maggio and Wintheiser
Edit
8
Gilberthaven
Emiliano
Moore
Gulgowski - Botsford
Edit
9
Kali Spurs
Alessandra
Smith
Maggio LLC
Edit
Loading...

Summary

Name
34,474
26,082
Esta Sawayn
7,835
7,556
Neoma Smitham
9,112
9,056
Hattie Conroy I
3,219
623
Melany Lakin
9,076
2,774
Rose Heller
5,232
6,073
Loading...

Show full text of cells

Display the hidden text in its entirety when hovering over the cell.

Name
Url
Company
Email
City
Street
Mike Smith
https://avatars.githubusercontent.com/u/83052992
Hauck Inc
Thad.Kertzmann52@hotmail.com
Fort Jett
Isabelle Hill
Russ Leannon
https://avatars.githubusercontent.com/u/6378044
Welch, Koch and Lind
Nathanael44@hotmail.com
North Ariane
Kuvalis Falls
Kaia Huels
https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/454.jpg
Thiel, Muller and Mayert
Rose.Mann77@hotmail.com
Kleinborough
Kevon Park
Earlene Brakus
https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/423.jpg
Hyatt, Thompson and Von
Norris.Boyle@hotmail.com
Kuhlmanstead
Mante Cape
Otto Hettinger
https://avatars.githubusercontent.com/u/62577096
Jacobi - Predovic
Mayra46@hotmail.com
Trompstad
Diego Landing
Adrien Johns
https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/613.jpg
Batz and Sons
Philip.Friesen@yahoo.com
Bothell
Desiree Gateway
Brando DuBuque
https://avatars.githubusercontent.com/u/51121665
Skiles and Sons
Waylon.Rice-Padberg90@hotmail.com
North Mariambury
Adelbert Cape
Bernhard Buckridge
https://avatars.githubusercontent.com/u/95709717
Smith - Schaden
Rosie_Moore@yahoo.com
DeSoto
Franey Locks
Geovanni Johnston
https://avatars.githubusercontent.com/u/19648960
Konopelski, Franey and Gerlach
Josephine_Torp@hotmail.com
Decatur
Collier Rapid
Kobe Pollich
https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/868.jpg
Bechtelar LLC
Magdalen.Cummings68@yahoo.com
Conroe
Towne Throughway
Alvina Gleichner
https://avatars.githubusercontent.com/u/12648926
Purdy - McKenzie
Gene_Kovacek34@hotmail.com
North Foster
Richard Knoll
Orval Treutel
https://avatars.githubusercontent.com/u/17134697
Lynch - Champlin
Sabina21@gmail.com
Harrisonburg
Pietro Forks
Scottie Goyette-Spinka
https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/232.jpg
Braun LLC
Alexandria97@hotmail.com
Port Samside
Bauch Greens
Kip Howe
https://avatars.githubusercontent.com/u/85669916
Ferry - Johns
Oscar_Jacobs@yahoo.com
West Lamontside
Emmerich Highway
Joel Marvin
https://avatars.githubusercontent.com/u/56394767
Walker Group
Kyleigh41@yahoo.com
Bogisichview
Nitzsche Knoll
Alexane Kessler
https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/642.jpg
Harber - Marks
Clinton53@hotmail.com
Greenwood
Willie Circles
Sabrina Gusikowski
https://avatars.githubusercontent.com/u/8801476
Denesik and Sons
Jean_Tillman@gmail.com
Devanteburgh
Zulauf Valleys
Kip Considine-Hickle
https://avatars.githubusercontent.com/u/99002945
Lang, Wolf and Legros
Luz42@hotmail.com
Rocklin
Predovic Ridge
Abbigail Collins
https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/482.jpg
McClure, Hermiston and Padberg
Zora.Schulist@hotmail.com
Muncie
Flatley Turnpike
Merle Nienow
https://avatars.githubusercontent.com/u/61963088
Jenkins, Terry and Rutherford
Rodger.Nienow33@gmail.com
Elliotside
Connelly Hill
Loading...

Word Wrap

Id
First Name
Last Name
City
Company Name
1
Red Wacky League AntlezBroketheStereoNeon Kitching Josh Bennett Evolution Dreams 红色古怪联盟丹尼尔梅斯马修
Schuppe
New Gust
Lebsack - Nicolas
2
Janis
Bode
New Gust
Glover - Hermiston
3
Makenzie Vandervort
New Gust
Williamson - Kassulke
4
Ciara
Towne
Vandervort
Hilpert, Eichmann and Brown
Loading...

⚠️ We do not recommend using wordWrap with virtualized, because virtualized only achieves the best performance with a fixed line height. You can use the fullText property to solve the problem of not displaying the full text.

Affix header & scrollbar

  • autoHeight: Table will expand the height according to the content.
  • affixHeader: Affix the table header to the specified location on the page.
  • affixHorizontalScrollbar: Affix the table horizontal scrollbar to the specified position on the page.
Id
First Name
Last Name
City
Gender
Age
Postcode
Email
Id
First Name
Last Name
City
Gender
Age
Postcode
Email
1
Talon
Powlowski
VonRuedenton
male
44
21189-6760
Loyal.Cronin-Armstrong@hotmail.com
2
Tyrese
Graham
North Rene
male
31
81171-3429
Dulce.OKeefe@yahoo.com
3
Antwan
Kirlin
Rochester
female
21
17518
Ardith9@yahoo.com
4
Andy
Zulauf
Port Abnerstead
male
46
31014-5731
Stefanie19@yahoo.com
5
Joesph
Baumbach
Gislasonberg
male
29
48451-6732
Alfonso.Franecki26@yahoo.com
6
Oleta
Wiegand
Alafaya
male
39
48450
Eugenia26@hotmail.com
7
Margarett
Kassulke
Moore
male
23
83534-3837
Aryanna85@gmail.com
8
Grover
Kohler
Shyannehaven
male
33
00798-6836
Raul74@hotmail.com
9
Shaniya
Farrell
North Blanche
male
22
60078
Shana_Botsford@gmail.com
10
Annalise
Stracke
Port Elianefield
female
24
89958
Jabari28@yahoo.com
Loading...

Infinite Loader

Index
Texts
0
Tempora maiores temporibus ducimus voluptatum nihil at maxime recusandae placeat. Rerum inventore quos facilis eius pariatur voluptates nisi ipsa. Et enim iusto debitis.
1
Eius aspernatur nobis hic et ipsum maiores alias. Officiis quia dolor voluptatem officiis quibusdam deserunt odit veritatis debitis. Quos molestiae aspernatur impedit.
2
Atque aliquam laudantium accusamus minus quasi aspernatur dicta libero ab. Consequatur voluptas fugit sequi. Temporibus tenetur sequi sequi accusamus.
3
Exercitationem cupiditate voluptatum nihil dolorem consequuntur a. Accusamus tempora quia architecto numquam illo excepturi fugiat. Itaque nostrum adipisci quo error aut aperiam ad fugit quia.
4
Laboriosam iste inventore ipsa officiis ratione neque. Tempora aliquam accusamus incidunt voluptatem minima. Amet incidunt expedita atque quos alias aut accusantium facere nobis.
5
Earum debitis quasi unde aspernatur recusandae dolore quaerat eos. Error totam unde quaerat doloribus voluptatibus dolore occaecati. Totam nostrum maxime.
6
Aliquam perferendis nobis fugit dolorum ab. Repudiandae possimus sint minima vero. Quaerat recusandae nesciunt minus distinctio esse nemo deserunt.
7
Repellendus occaecati incidunt deleniti aspernatur voluptatum reiciendis consectetur. Voluptatem molestiae possimus. Dignissimos facilis laboriosam quasi deleniti.
8
Ullam quasi dolorum sed nemo deleniti. Omnis accusamus cupiditate dolorem enim totam. Recusandae laboriosam natus.
9
Autem eaque quidem. Quia quod necessitatibus blanditiis. Occaecati pariatur commodi in.
10
Eveniet magni dolorum minima eius dolorum delectus. Quisquam velit quam voluptatibus. Libero nihil dignissimos asperiores rem rem quam dolorum libero.
11
Quis dolor vel consequuntur nisi perspiciatis consectetur inventore similique. Totam excepturi deleniti earum necessitatibus quae accusantium. Ipsa quod laboriosam dolores dolore.
12
Occaecati eum ipsum ex in officiis velit ullam. Nemo accusamus corrupti magni. Sapiente qui iste aspernatur quam expedita officiis.
Loading...

Draggable(with react-dnd)

Accessibility

  • <Table> has role grid.
  • <Table> has role treegrid, when <Table> is set with isTree.
  • <HeanderCell> has role columnheader.
  • <Cell> has role gridcell.
  • Rows dynamically generated from data in the <Table> has role row.
  • Use the aria-rowcount prop to identify the total number of rows available, and the aria-rowindex prop to identify the index of the row.
  • Use the aria-colcount prop to identify the total number of available columns, and the aria-colindex prop to identify the index of the column.
  • When sorting a column, you can apply the aria-sort prop to the column header to indicate the sorting method.
aria-sort Description
ascending Data are sorted in ascending order.
descending Data are sorted in descending order.
none Default (no sort applied).
other Data are sorted by an algorithm other than ascending or descending.

Props

<Table>

Property Type (Default) Description
affixHeader boolean | number Affix the table header to the specified location on the page
affixHorizontalScrollbar boolean | number Affix the table horizontal scrollbar to the specified position on the page
autoHeight boolean The height of the table will be automatically expanded according to the number of data rows, and no vertical scroll bar will appear
bordered boolean Show border
cellBordered boolean Show cell border
children (components: { Cell, HeaderCell, Column, ColumnGroup }) => React.ReactNode | React.ReactNode Render props that receives parameterized Cell, HeaderCell, Column, ColumnGroup components - making typescript usage more convenient
data * object[] Table data
defaultExpandAllRows boolean Expand all nodes By default
defaultExpandedRowKeys string[] Specify the default expanded row by rowkey
defaultSortType 'desc' | 'asc' Sort type
expandedRowKeys string[] Specify the default expanded row by rowkey (Controlled)
fillHeight boolean Force the height of the table to be equal to the height of its parent container. Cannot be used together with autoHeight.
headerHeight number(40) Table Header Height
height number(200) Table height
hover boolean (true) The row of the table has a mouseover effect
isTree boolean Show as Tree table
loading boolean Show loading
locale TableLocaleType Locale text
minHeight number (0) Minimum height
onDataUpdated (nextData: object[], scrollTo: (coord: { x: number; y: number }) => void) => void Callback after table data update.
onExpandChange (expanded:boolean, rowData:object) => void Tree table, the callback function in the expanded node
onRowClick (rowData:object) => void Click the callback function after the row and return to rowDate
onScroll (scrollX:object, scrollY:object) => void Callback function for scroll bar scrolling
onSortColumn (dataKey:string, sortType:string) => void Click the callback function of the sort sequence to return the value sortColumn, sortType
renderEmpty (info: ReactNode) => ReactNode Customized data is empty display content
renderLoading (loading: ReactNode) => ReactNode Customize the display content in the data load
renderRow (children?: ReactNode, rowData?: RowDataType) => ReactNode Custom row element
renderRowExpanded (rowDate?: Object) => ReactNode Customize what you can do to expand a zone
renderTreeToggle (icon:node, rowData:object, expanded:boolean) => ReactNode Tree table, the callback function in the expanded node
rowClassName string | (rowData:object, rowIndex:number) => string Add an optional extra class name to row
rowExpandedHeight number (100) Set the height of an expandable area
rowHeight (rowData:object) => number, number(46) Row height
rowKey string ('key') Each row corresponds to the unique key in data
shouldUpdateScroll boolean | (event)=>({x,y}) (true) Use the return value of shouldUpdateScroll to determine whether to update the scroll after the table size is updated
showHeader boolean (true) Display header
sortColumn string Sort column name
sortType 'desc' | 'asc' Sort type (Controlled)
virtualized boolean Effectively render large tabular data
width number Table width
wordWrap boolean | 'break-all' | 'break-word' | 'keep-all' Whether to appear line breaks where text overflows its content box

Table ref

Property Type Description
body HTMLDivElement The body element of the table
root HTMLDivElement The root element of the table
scrollLeft (left:number)=>void Set the number of pixels for horizontal scrolling of the table
scrollPosition {top:number,left:number} The scroll position of the table
scrollTop (top:number)=>void Set the number of pixels for vertical scrolling of the table

<Table.Column>

Property Type (Default) Description
align 'left' | 'center' | 'right' Alignment
colSpan number Merges column cells to merge when the dataKey value for the merged column is null or undefined.
fixed boolean | 'left' | 'right' Fixed column
flexGrow number Set the column width automatically adjusts, when set flexGrow cannot set resizable and width property
fullText boolean Whether to display the full text of the cell content when the mouse is hovered
minWidth number(200) When you use flexGrow, you can set a minimum width by minwidth
onResize (columnWidth?: number, dataKey?: string) => void Callback after column width change
resizable boolean Customizable Resize Column width
rowSpan (rowData: any) => number Merges rows on the specified column.
sortable boolean Sortable
treeCol boolean A column of a tree.
verticalAlign 'top' | 'middle' | 'bottom' Vertical alignment
width number Column width

sortable is used to define whether the column is sortable, but depending on what key sort needs to set a dataKey in Cell. The sort here is the service-side sort, so you need to handle the logic in the ' Onsortcolumn ' callback function of <Table>, and the callback function returns sortColumn, sortType values.

<Table.ColumnGroup>

Property Type (Default) Description
align 'left' | 'center' | 'right' Alignment
fixed boolean, 'left', 'right' Fixed column group
groupHeaderHeight number The height of the header of the merged cell group. The default value is 50% of the table headerHeight
header ReactNode Group header
verticalAlign 'top' | 'middle' | 'bottom' Vertical alignment

<Table.HeaderCell>

Property Type (Default) Description
children ReactNode The table column header displays the content
renderSortIcon (sortType?: 'desc' | 'asc' ) => ReactNode Custom render sort icons on column headers

<Table.Cell>

Property Type (Default) Description
dataKey string Data binding key, but also a sort of key
rowData object Row data
rowIndex number Row number
Vercel banner