Skip to content

Table

Display tabular data in row format, built with React Table. Some examples use the following variables for brevity:

A basic table.
First Name
Last Name
Email
JohnDoejohn@doe.com
DorothyBoedorothy@boe.com
BabyMoebaby@moe.com
1
const columns = [
2
{
3
Header: 'First Name',
4
accessor: 'first'
5
},
6
{
7
Header: 'Last Name',
8
accessor: 'last'
9
},
10
{
11
Header: 'Email',
12
accessor: 'email'
13
}
14
]
15
16
const data = [
17
{
18
first: 'John',
19
last: 'Doe',
20
email: 'john@doe.com'
21
},
22
{
23
first: 'Dorothy',
24
last: 'Boe',
25
email: 'dorothy@boe.com'
26
},
27
{
28
first: 'Baby',
29
last: 'Moe',
30
email: 'baby@moe.com'
31
}
32
]

Always provide a caption. Columns and data must be memoized.

A basic table.
First Name
Last Name
Email
JohnDoejohn@doe.com
DorothyBoedorothy@boe.com
BabyMoebaby@moe.com
Code Editor
A table with placeholder rows.
First Name
Last Name
Email
Code Editor

Use the same number of placeholder rows used while loading to avoid layout shift.

An empty table.
First Name
Last Name
Email
No rows to display. Import a project?
Code Editor

Set the align property to change text alignment. Left by default.

A table with right and left aligned columns.
First Name
Last Name
Email
JohnDoejohn@doe.com
DorothyBoedorothy@boe.com
BabyMoebaby@moe.com
Code Editor

Pass a number to change the minimum width of the table. Disable with a falsy value.

A table with minimum with of 1000px.
First Name
Last Name
Email
JohnDoejohn@doe.com
DorothyBoedorothy@boe.com
BabyMoebaby@moe.com
Code Editor

Passing columnClassName applies the class to all headers and cells of the column.

A basic table with columnClassName applied to the second column.
First Name
Last Name
Email
JohnDoejohn@doe.com
DorothyBoedorothy@boe.com
BabyMoebaby@moe.com
Code Editor

Ensures column widths are stable, regardless of cell contents.

A table with fixed layout.
First Name
Last Name
Email
JohnDoejohn@doe.com
DorothyBoedorothy@boe.com
BabyMoebaby@moe.com
Code Editor

Manually set a column width.

A table with fixed column widths.
First Name
Last Name
Email
moodmatchjam
bedroomrailwayrun
emotionmistlearning
Code Editor

Long cell values will wrap within the cell.

A table with data that is really long and fixed.
First Name
Last Name
Email
Hubert BlaineWolfeschlegelsteinhausenbergerdorffjohn@wolfeschlegelsteinhausenbergerdorff.com
TarquinFin-tim-lin-bin-whin-bim-lim-bus-stop-F’tang-F’tang-Olé-Biscuitbarreltarquin@Fin-tim-lin-bin-whin-bim-lim-bus-stop-F’tang-F’tang-Olé-Biscuitbarrel.com
Pablo Diego José Francisco de Paula Juan NepomucenoMaría de los Remedios Cipriano de la Santísima Trinidad Ruiz y Picassosuperlongemailaddress010100100101010101001@email.com
ThisIsASuperLongSingleWordThatShouldBeHandledThisIsAnotherSuperLongSingleWordThatShouldBeHandledthisIsAnotherSuperLongSingleWordThatShouldBeHandled@email.com
Code Editor

Columns are still required, fixed widths are respected.

A table without a table header.
First Name
Last Name
Email
JohnDoejohn@doe.com
DorothyBoedorothy@boe.com
BabyMoebaby@moe.com
Code Editor

Enabled per column, long cell values are automatically truncated. Requires fixed layout.

A table that truncates long cells.
Column One
Column Two
Column Three
Column Four
impolite-lock-plastic-jokehollow-bridge-downtown-mentorthirsty-texture-phone-locktwo-donkey-environment-rain
sad-operation-space-flowersuitable-leader-magic-blushboundless-wing-word-improvethoughtless-disgust-pet-visit
nice-skirt-security-coughfluttering-books-perspective-sowlean-plough-possession-disappearbest-administration-attempt-update
wholesale-bottle-hands-puncturedeserted-clouds-coat-nominatefat-passion-branch-learntruculent-houses-pot-bruise
accessible-bite-church-sayblue-servant-lumber-foretelllush-lake-business-restructurefeeble-wind-wound-reply
Code Editor

Specify a number to change the offset from 0.

A table with a sticky header.
First Name
Last Name
Email
JohnDoejohn@doe.com
DorothyBoedorothy@boe.com
BabyMoebaby@moe.com
JohnDoejohn@doe.com
DorothyBoedorothy@boe.com
BabyMoebaby@moe.com
JohnDoejohn@doe.com
DorothyBoedorothy@boe.com
BabyMoebaby@moe.com
Code Editor

Hold shift to sort by multiple columns. Columns can disable sorting.

A table with sortable columns.
First Name
Last Name
Email
accidentpaperrings
feastattemptloaf
restraketendency
Code Editor

Sort function must be memoized. Sorts alphanumerically by default.

A table with sortable columns.
First Name
Last Name
Age
JohnDoe36
DorothyBoe45
BabyMoe2
Code Editor

Hold shift to toggle many rows.

A table with selectable rows.
First Name
Last Name
Email
mediachairscontrol
cookierevenuepossession
experiencepresencerange
Code Editor

Disable items in rowActions for disabled rows as needed.

A table with selectable and disabled rows.
First Name
Last Name
Email
JohnDoejohn@doe.com
categoryflagefficiency
stovesoapstory
professordowntownmove
Code Editor

Filter rows that already displayed. This is not used for server-side search. Common filter function like useTextFilter are provided.

A table with a search filter.
First Name
Last Name
Email
aspectdevelopmentmeeting
fingermeasurecurrent
womenfriendsberry
Code Editor

Only specify the first property to render full width content.

A table with expandable rows.
Item
Count
Unit Price
Price
Preview Deployment Suffix1$100$100
Additional Items
More Details
Code Editor

Filters should be memoized, and are applied sequentially.

A table with a search filter and selectable rows.
Project
URL
Deployed
Blogvercel.com/blog23h ago
Homevercel.com7d ago
Design Systemvercel.com/design30m ago
Homevercel.com14d ago
Code Editor