MRT logoMantine React Table

On This Page

    Row Numbers Feature Guide

    Mantine React 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''static'

    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.

    #
    First Name
    Last Name
    Address
    City
    State
    1DylanMurray261 Erdman FordEast DaphneKentucky
    2RaquelKohler769 Dominic GroveColumbusOhio
    3ErvinReinger566 Brakus InletSouth LindaWest Virginia
    4BrittanyMcCullough722 Emie StreamLincolnNebraska
    5BransonFrami32188 Larkin TurnpikeCharlestonSouth Carolina

    Rows per page

    1-5 of 5

    import '@mantine/core/styles.css';
    import '@mantine/dates/styles.css'; //if using mantine date picker features
    import 'mantine-react-table/styles.css'; //make sure MRT styles were imported in your app root (once)
    import { MantineReactTable, useMantineReactTable } from 'mantine-react-table';
    import { columns, data } from './makeData';
    
    const Example = () => {
      const table = useMantineReactTable({
        columns,
        data,
        enableRowNumbers: true,
        rowNumberDisplayMode: 'static', //default
      });
    
      return <MantineReactTable table={table} />;
    };
    
    export default 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.

    #
    First Name
    Last Name
    Address
    City
    State
    1DylanMurray261 Erdman FordEast DaphneKentucky
    2RaquelKohler769 Dominic GroveColumbusOhio
    3ErvinReinger566 Brakus InletSouth LindaWest Virginia
    4BrittanyMcCullough722 Emie StreamLincolnNebraska
    5BransonFrami32188 Larkin TurnpikeCharlestonSouth Carolina

    Rows per page

    1-5 of 5

    import '@mantine/core/styles.css';
    import '@mantine/dates/styles.css'; //if using mantine date picker features
    import 'mantine-react-table/styles.css'; //make sure MRT styles were imported in your app root (once)
    import { MantineReactTable, useMantineReactTable } from 'mantine-react-table';
    import { columns, data } from './makeData';
    
    const Example = () => {
      const table = useMantineReactTable({
        columns,
        data,
        enableRowNumbers: true,
        rowNumberDisplayMode: 'original',
      });
    
      return <MantineReactTable table={table} />;
    };
    
    export default Example;

    View Extra Storybook Examples