Fixed header

Set fixedHeader to keep the column headers visible while the user scrolls through a long dataset. The table body becomes independently scrollable within a container whose height is controlled by fixedHeaderScrollHeight.

Fixed header

40 rows in a scrollable container. Toggle fixed header on/off and change the scroll height with the controls above the table.

fixedHeaderScrollHeight:
#
Name
Department
Salary
Status
1
Aria Chen
Engineering
$80,000
Active
2
Marcus Webb
Product
$81,237
Remote
3
Priya Kapoor
Design
$82,474
On Leave
4
Jordan Ellis
Analytics
$83,711
Contractor
5
Sam Rivera
Sales
$84,948
Active
6
Taylor Brooks
HR
$86,185
Remote
7
Casey Morgan
Engineering
$87,422
On Leave
8
Alex Kim
Product
$88,659
Contractor
9
Morgan Lee
Design
$89,896
Active
10
Drew Park
Analytics
$91,133
Remote
11
Aria Chen 2
Sales
$92,370
On Leave
12
Marcus Webb 2
HR
$93,607
Contractor
13
Priya Kapoor 2
Engineering
$94,844
Active
14
Jordan Ellis 2
Product
$96,081
Remote
15
Sam Rivera 2
Design
$97,318
On Leave
16
Taylor Brooks 2
Analytics
$98,555
Contractor
17
Casey Morgan 2
Sales
$99,792
Active
18
Alex Kim 2
HR
$101,029
Remote
19
Morgan Lee 2
Engineering
$102,266
On Leave
20
Drew Park 2
Product
$103,503
Contractor
21
Aria Chen 3
Design
$104,740
Active
22
Marcus Webb 3
Analytics
$105,977
Remote
23
Priya Kapoor 3
Sales
$107,214
On Leave
24
Jordan Ellis 3
HR
$108,451
Contractor
25
Sam Rivera 3
Engineering
$109,688
Active
26
Taylor Brooks 3
Product
$110,925
Remote
27
Casey Morgan 3
Design
$112,162
On Leave
28
Alex Kim 3
Analytics
$113,399
Contractor
29
Morgan Lee 3
Sales
$114,636
Active
30
Drew Park 3
HR
$115,873
Remote
31
Aria Chen 4
Engineering
$117,110
On Leave
32
Marcus Webb 4
Product
$118,347
Contractor
33
Priya Kapoor 4
Design
$119,584
Active
34
Jordan Ellis 4
Analytics
$120,821
Remote
35
Sam Rivera 4
Sales
$122,058
On Leave
36
Taylor Brooks 4
HR
$123,295
Contractor
37
Casey Morgan 4
Engineering
$124,532
Active
38
Alex Kim 4
Product
$125,769
Remote
39
Morgan Lee 4
Design
$127,006
On Leave
40
Drew Park 4
Analytics
$128,243
Contractor

How it works

When fixedHeader is enabled, the responsive wrapper gains overflow-y: auto and the max-height you set via fixedHeaderScrollHeight. The column header row gets position: sticky; top: 0 so it remains in view as the body scrolls within that container.

Because the scroll container is the responsive wrapper, horizontal scrolling for wide tables continues to work normally. Both axes scroll together, but the header sticks on the vertical axis.

With pagination

Fixed header and pagination work together without any extra configuration. The scroll height only constrains the table body rows. The pagination bar sits below the responsive wrapper and is always fully visible.

<DataTable
  columns={columns}
  data={data}
  fixedHeader
  fixedHeaderScrollHeight="400px"
  pagination
  paginationPerPage={20}
/>

With selection

The checkbox column header scrolls with all other headers and stays fixed. The select-all checkbox remains accessible at the top of the scrollable area.

<DataTable
  columns={columns}
  data={data}
  fixedHeader
  fixedHeaderScrollHeight="350px"
  selectableRows
/>

Prop reference

Prop Type Default Description
fixedHeader boolean false Stick column headers to the top of the scroll container.
fixedHeaderScrollHeight string "100vh" Any valid CSS length (px, vh, %, etc.). Sets the max-height of the scrollable body region. Only applies when fixedHeader is true.