Shadcn React Table

Search documentation

Search the docs

Row pinning

Set enableRowPinning: true to add a pin toggle inside the row-number column. Pinned rows stick to the top while you scroll the rest of the table.

Because the toggle lives in the row-number column, row pinning pairs with enableRowNumbers: true.

Row pinningPin rows to the top via the row-number column.
GitHub
#
ID
1AvaThompsonOwnerEngineeringactive22$45,000Jan 2, 2023
0%
2LiamNguyenAdminMarketinginactive25$47,137Jan 13, 2023
9%
3NoahSilvaEditorDesignpending28$49,274Jan 24, 2023
18%
4EmmaCarterViewerSalesactive31$51,411Feb 4, 2023
27%
5OliviaRossiOwnerSupportinactive34$53,548Feb 15, 2023
36%
6WilliamWalkerAdminEngineeringpending37$55,685Feb 26, 2023
45%
7SophiaPatelEditorMarketingactive40$57,822Mar 9, 2023
54%
8JamesMullerViewerDesigninactive43$59,959Mar 20, 2023
63%
9IsabellaParkOwnerSalespending46$62,096Mar 31, 2023
72%
10LucasReyesAdminSupportactive49$64,233Apr 11, 2023
81%
$4,120,536
Rows per page
1–10 of 48
tsx
const table = useDataTable({
  data,
  columns,
  getRowId: (row) => row.id,
  enableRowNumbers: true,
  enableRowPinning: true,
})

return <DataTable table={table} />

Enable row numbers

Turn on enableRowNumbers so the pin toggle has a column to live in.

Display modes

rowPinningDisplayMode sets where pinned rows show and how rows get pinned:

ModePinned rowsPinned by
"top-and-bottom" (default)Stay in view above (or below) the other rows while scrollingThe pin button (to the top), or row.pin("bottom")
"top" / "bottom"The sameThe pin button, to that side
"static"Listed first (or last), and scroll away with the restThe pin button
"select-top" / "select-bottom"Stay in view on that sideSelecting the row; deselecting unpins it. No pin buttons
tsx
useDataTable({
  data,
  columns,
  enableRowSelection: true,
  enableRowPinning: true,
  rowPinningDisplayMode: "select-top", // selected rows stay in view at the top
})

Sticky pinned rows have a solid line and a soft shadow on the edge that faces the other rows. They need a bounded scroll surface, which the table has by default (see Sticky header & footer).

Row pinning modesSticky, static and selection-driven pinned rows.
GitHub
rowPinningDisplayMode
Pin row
ID
OliviaRossiOwnerSupportinactive34$53,548Feb 15, 2023
36%
AvaThompsonOwnerEngineeringactive22$45,000Jan 2, 2023
0%
LiamNguyenAdminMarketinginactive25$47,137Jan 13, 2023
9%
NoahSilvaEditorDesignpending28$49,274Jan 24, 2023
18%
EmmaCarterViewerSalesactive31$51,411Feb 4, 2023
27%
WilliamWalkerAdminEngineeringpending37$55,685Feb 26, 2023
45%
SophiaPatelEditorMarketingactive40$57,822Mar 9, 2023
54%
JamesMullerViewerDesigninactive43$59,959Mar 20, 2023
63%
IsabellaParkOwnerSalespending46$62,096Mar 31, 2023
72%
LucasReyesAdminSupportactive49$64,233Apr 11, 2023
81%
MiaJohanssonEditorEngineeringinactive52$66,370Apr 22, 2023
90%
BenjaminCostaViewerMarketingpending55$68,507May 3, 2023
99%
CharlotteChenOwnerDesignactive58$70,644May 14, 2023
7%
HenryCohenAdminSalesinactive61$72,781May 25, 2023
16%
AmeliaNovakEditorSupportpending24$74,918Jun 5, 2023
25%
JackDiazViewerEngineeringactive27$77,055Jun 16, 2023
34%
HarperDuboisOwnerMarketinginactive30$79,192Jun 27, 2023
43%
LeoHaddadAdminDesignpending33$81,329Jul 8, 2023
52%
EllaKhanEditorSalesactive36$83,466Jul 19, 2023
61%
MasonTanakaViewerSupportinactive39$85,603Jul 30, 2023
70%
AvaThompsonOwnerEngineeringpending42$87,740Aug 10, 2023
79%
LiamNguyenAdminMarketingactive45$89,877Aug 21, 2023
88%
NoahSilvaEditorDesigninactive48$92,014Sep 1, 2023
97%
EmmaCarterViewerSalespending51$94,151Sep 12, 2023
5%
OliviaRossiOwnerSupportactive54$96,288Sep 23, 2023
14%
WilliamWalkerAdminEngineeringinactive57$98,425Oct 4, 2023
23%
SophiaPatelEditorMarketingpending60$100,562Oct 15, 2023
32%
JamesMullerViewerDesignactive23$102,699Oct 26, 2023
41%
IsabellaParkOwnerSalesinactive26$104,836Nov 6, 2023
50%
LucasReyesAdminSupportpending29$106,973Nov 17, 2023
59%
MiaJohanssonEditorEngineeringactive32$109,110Nov 28, 2023
68%
BenjaminCostaViewerMarketinginactive35$111,247Dec 9, 2023
77%
CharlotteChenOwnerDesignpending38$113,384Dec 20, 2023
86%
HenryCohenAdminSalesactive41$115,521Dec 31, 2023
95%
AmeliaNovakEditorSupportinactive44$117,658Jan 11, 2024
3%
JackDiazViewerEngineeringpending47$119,795Jan 22, 2024
12%
HarperDuboisOwnerMarketingactive50$121,932Feb 2, 2024
21%
LeoHaddadAdminDesigninactive53$124,069Feb 13, 2024
30%
EllaKhanEditorSalespending56$126,206Feb 24, 2024
39%
MasonTanakaViewerSupportactive59$128,343Mar 6, 2024
48%
AvaThompsonOwnerEngineeringinactive22$130,480Mar 17, 2024
57%
LiamNguyenAdminMarketingpending25$132,617Mar 28, 2024
66%
NoahSilvaEditorDesignactive28$134,754Apr 8, 2024
75%
EmmaCarterViewerSalesinactive31$46,891Apr 19, 2024
84%
OliviaRossiOwnerSupportpending34$49,028Apr 30, 2024
93%
WilliamWalkerAdminEngineeringactive37$51,165May 11, 2024
1%
SophiaPatelEditorMarketinginactive40$53,302May 22, 2024
10%
JamesMullerViewerDesignpending43$55,439Jun 2, 2024
19%
IsabellaParkOwnerSalesactive46$57,576Jun 13, 2024
28%
LucasReyesAdminSupportinactive49$59,713Jun 24, 2024
37%
BenjaminCostaViewerMarketingactive55$63,987Jul 16, 2024
55%
CharlotteChenOwnerDesigninactive58$66,124Jul 27, 2024
64%
HenryCohenAdminSalespending61$68,261Aug 7, 2024
73%
AmeliaNovakEditorSupportactive24$70,398Aug 18, 2024
82%
JackDiazViewerEngineeringinactive27$72,535Aug 29, 2024
91%
HarperDuboisOwnerMarketingpending30$74,672Sep 9, 2024
100%
LeoHaddadAdminDesignactive33$76,809Sep 20, 2024
8%
EllaKhanEditorSalesinactive36$78,946Oct 1, 2024
17%
MasonTanakaViewerSupportpending39$81,083Oct 12, 2024
26%
MiaJohanssonEditorEngineeringpending52$61,850Jul 5, 2024
46%
$4,952,490