Shadcn React Table

Search documentation

Search the docs

Row numbers

Set enableRowNumbers: true to add a leading row-number column to the table.

Row numbers
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
const table = useDataTable({
  data,
  columns,
  getRowId: (row) => row.id,
  enableRowNumbers: true,
})

return <DataTable table={table} />

Numbering mode

rowNumberMode controls how the numbers are computed:

  • "static" (default) numbers the current view and is page-aware, so the first visible row on each page restarts the count appropriately.
  • "original" uses the source row index, so each row keeps the same number regardless of sorting or pagination.
const table = useDataTable({
  data,
  columns,
  getRowId: (row) => row.id,
  enableRowNumbers: true,
  rowNumberMode: "original",
})

Pairs with row pinning

The row-number column is also where the pin toggle lives, so it works well alongside row pinning.