DocsGuides

Guides

Row Numbers Guide

How to use and customize automatic row numbers in Shadcn Table

Shadcn Table has an easy to implement row number features. There are two row number modes that you can enable. You can have row numbers that are associated with the data in the table (original mode), or you can have row numbers that are just statically part of the table (static mode).

Relevant Table Options

#
Prop Name
Type
Default Value
More Info Links
1booleanRow Numbers Feature Guide
2'original' | 'static''original'

Enable Row Numbers (Static Mode)

In the default rowNumberDisplayMode (static), row numbers are just a static part of the table in their own column. They act like the row numbers in an excel spreadsheet. Sorting and filtering will not affect the row numbers.

Loading example

Enable Row Numbers (Original Mode)

Alternatively, use the "original" rowNumberDisplayMode to have row numbers linked to the original index of the data array. This means that when you search or filter, the same row numbers will stay with the same rows as data is sorted and filtered.

Loading example

View Extra Storybook Examples

On this page