Table Components
Basic Table
Simple Table
| Name | Job | Favorite Color | |
|---|---|---|---|
| 1 | Cy Ganderton | Quality Control Specialist | Blue |
| 2 | Hart Hagerty | Desktop Support Technician | Purple |
| 3 | Brice Swyre | Tax Accountant | Red |
With Border and Background
| Name | Job | Favorite Color | |
|---|---|---|---|
| 1 | Cy Ganderton | Quality Control Specialist | Blue |
| 2 | Hart Hagerty | Desktop Support Technician | Purple |
| 3 | Brice Swyre | Tax Accountant | Red |
Row States
With Active Row
| Name | Job | |
|---|---|---|
| 1 | Cy Ganderton | Quality Control Specialist |
| 2 | Hart Hagerty | Desktop Support Technician |
Hover Highlight
| Name | Job | |
|---|---|---|
| 1 | Cy Ganderton | Quality Control Specialist |
| 2 | Hart Hagerty (hover me) | Desktop Support Technician |
Zebra Striping
Zebra Stripes
| Name | Job | Favorite Color | |
|---|---|---|---|
| 1 | Cy Ganderton | Quality Control Specialist | Blue |
| 2 | Hart Hagerty | Desktop Support Technician | Purple |
| 3 | Brice Swyre | Tax Accountant | Red |
Table Sizes
Extra Small (xs)
| Name | Job | Company | Location | Date | Color | |
|---|---|---|---|---|---|---|
| 1 | Person 1 | Job 1 | Company 1 | Location 1 | 01/1/2024 | Blue |
| 2 | Person 2 | Job 2 | Company 2 | Location 2 | 01/2/2024 | Red |
| 3 | Person 3 | Job 3 | Company 3 | Location 3 | 01/3/2024 | Green |
| 4 | Person 4 | Job 4 | Company 4 | Location 4 | 01/4/2024 | Purple |
| 5 | Person 5 | Job 5 | Company 5 | Location 5 | 01/5/2024 | Yellow |
Small (sm)
| Name | Job | Color | |
|---|---|---|---|
| 1 | Cy Ganderton | Quality Control Specialist | Blue |
| 2 | Hart Hagerty | Desktop Support Technician | Purple |
| 3 | Brice Swyre | Tax Accountant | Red |
Large (lg)
| Name | Job | Color | |
|---|---|---|---|
| 1 | Cy Ganderton | Quality Control Specialist | Blue |
| 2 | Hart Hagerty | Desktop Support Technician | Purple |
| 3 | Brice Swyre | Tax Accountant | Red |
Pinned Rows (Sticky Header/Footer)
Scrollable with Pinned Headers
Scroll to see sticky headers
| Heroes - A |
|---|
| Ant-Man |
| Aquaman |
| Asterix |
| Heroes - B |
| Batman |
| Black Panther |
| Heroes - C |
| Captain America |
| Captain Marvel |
| Heroes - D |
| Daredevil |
| Doctor Strange |
| Heroes - S |
| Spider-Man |
| Superman |
| Heroes - T |
| Thor |
| Heroes - W |
| Wolverine |
| Wonder Woman |
Pinned Rows & Columns
Sticky Header and First/Last Columns
Scroll horizontally and vertically to see sticky elements
| Name | Job | Company | Location | Date | Color | ||
| 1 | Person 1 | Job 1 | Company 1 | Location 1 | 01/1/2024 | Blue | 1 |
| 2 | Person 2 | Job 2 | Company 2 | Location 2 | 01/2/2024 | Red | 2 |
| 3 | Person 3 | Job 3 | Company 3 | Location 3 | 01/3/2024 | Green | 3 |
| 4 | Person 4 | Job 4 | Company 4 | Location 4 | 01/4/2024 | Purple | 4 |
| 5 | Person 5 | Job 5 | Company 5 | Location 5 | 01/5/2024 | Yellow | 5 |
| 6 | Person 6 | Job 6 | Company 6 | Location 6 | 01/6/2024 | Blue | 6 |
| 7 | Person 7 | Job 7 | Company 7 | Location 7 | 01/7/2024 | Red | 7 |
| 8 | Person 8 | Job 8 | Company 8 | Location 8 | 01/8/2024 | Green | 8 |
| 9 | Person 9 | Job 9 | Company 9 | Location 9 | 01/9/2024 | Purple | 9 |
| 10 | Person 10 | Job 10 | Company 10 | Location 10 | 01/10/2024 | Yellow | 10 |
| 11 | Person 11 | Job 11 | Company 11 | Location 11 | 01/11/2024 | Blue | 11 |
| 12 | Person 12 | Job 12 | Company 12 | Location 12 | 01/12/2024 | Red | 12 |
| 13 | Person 13 | Job 13 | Company 13 | Location 13 | 01/1/2024 | Green | 13 |
| 14 | Person 14 | Job 14 | Company 14 | Location 14 | 01/2/2024 | Purple | 14 |
| 15 | Person 15 | Job 15 | Company 15 | Location 15 | 01/3/2024 | Yellow | 15 |
| 16 | Person 16 | Job 16 | Company 16 | Location 16 | 01/4/2024 | Blue | 16 |
| 17 | Person 17 | Job 17 | Company 17 | Location 17 | 01/5/2024 | Red | 17 |
| 18 | Person 18 | Job 18 | Company 18 | Location 18 | 01/6/2024 | Green | 18 |
| 19 | Person 19 | Job 19 | Company 19 | Location 19 | 01/7/2024 | Purple | 19 |
| 20 | Person 20 | Job 20 | Company 20 | Location 20 | 01/8/2024 | Yellow | 20 |
| Name | Job | Company | Location | Date | Color |
With Visual Elements
Checkboxes, Avatars, Badges, and Buttons
| Name | Job | Status | ||
|---|---|---|---|---|
C Cy Ganderton United States | Quality Control Specialist Department | Blue | ||
H Hart Hagerty United States | Desktop Support Technician Department | Purple | ||
B Brice Swyre United States | Tax Accountant Department | Red |
With Status Indicators
Avatars with Online/Offline Status
| User | Status | Role | |
|---|---|---|---|
| 1 | C Cy Ganderton cy@example.com | Online | Quality Control |
| 2 | H Hart Hagerty hart@example.com | Offline | Desktop Support |
| 3 | B Brice Swyre brice@example.com | Online | Tax Accountant |
Sortable Table Component
Sortable Table with Drag Handles (uncontrolled)
| Name | Job | Favorite Color | |
|---|---|---|---|
| Quality Control | Blue | ||
| Desktop Support | Purple | ||
| Tax Accountant | Red | ||
| Insurance Broker | Green | ||
| Sales Manager | Yellow |
<SortableTable head={ [ 'Name' , 'Job' , 'Favorite Color' ] } defaultItems={ people } renderRow={ person => ( <SortableTableRow><td>...</td></SortableTableRow> )}/>// the empty handle-column <th> is prepended automaticallyWhole-Row Dragging (controlled, zebra)
Current order :1 , 2 , 3 , 4 , 5
| # | Name | Job |
|---|---|---|
| 1 | Cy Ganderton | Quality Control |
| 2 | Hart Hagerty | Desktop Support |
| 3 | Brice Swyre | Tax Accountant |
| 4 | Marjy Ferencz | Insurance Broker |
| 5 | Yancy Tear | Sales Manager |
<SortableTable zebra handle={ false } items={ rows } onReorder={ next => setRows( next ) }/>// zebra stripes follow DOM positions : they reassign after a dropSticky Header (pinRows + vertical scroll)
| Name | Job | Favorite Color | |
|---|---|---|---|
| Cy Ganderton | Quality Control | Blue | |
| Hart Hagerty | Desktop Support | Purple | |
| Brice Swyre | Tax Accountant | Red | |
| Marjy Ferencz | Insurance Broker | Green | |
| Yancy Tear | Sales Manager | Yellow | |
| Irma Vasilik | Designer | Teal | |
| Icarus Gnosis | Developer | Orange | |
| Sylvia Plummer | Writer | Pink | |
| Cy Ganderton | Quality Control | Blue | |
| Hart Hagerty | Desktop Support | Purple | |
| Brice Swyre | Tax Accountant | Red | |
| Marjy Ferencz | Insurance Broker | Green |
<SortableTable pinRows containerClassName="max-h-72 overflow-y-auto"/>// the header stays sticky while rows scroll and reorder underneathAsync Reorder with API Call (optimistic revert on failure)
| Name | Job | |
|---|---|---|
| Cy Ganderton | Quality Control | |
| Hart Hagerty | Desktop Support | |
| Brice Swyre | Tax Accountant | |
| Marjy Ferencz | Insurance Broker |
<SortableTable defaultItems={ people } onReorder={ ( items ) => api.saveOrder( items ) }/>// onReorder may return a promise : a rejection restores the previous orderProps Reference
| Prop | Type | Description |
|---|---|---|
items / defaultItems | Array | Controlled / uncontrolled rows (each needs a stable id) |
onReorder | function | (items, { from, to, item }) => void | Promise — a rejected promise reverts the order (uncontrolled) |
renderRow | function | (item, index) => SortableTableRow element (children = the td cells) |
head / foot | Array | Header / footer cells, one entry per column (the handle column th is added automatically) |
handle | boolean | Show a drag-handle cell (default true) ; false = whole rows draggable |
getItemId / disabled | — | Same contract as the other sortable components |
zebra / pinRows / size / ... | Table props | Every other prop is forwarded to Table |