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

    1
    boolean
    Row Numbers Feature Guide
    2
    'original' | 'static'
    'static'

    Enable Row Numbers (Static Mode)

    In the default rowNumberMode (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.
    1DylanMurray261 Erdman FordEast DaphneKentucky
    2RaquelKohler769 Dominic GroveColumbusOhio
    3ErvinReinger566 Brakus InletSouth LindaWest Virginia
    4BrittanyMcCullough722 Emie StreamLincolnNebraska
    5BransonFrami32188 Larkin TurnpikeCharlestonSouth Carolina
    1-5 of 5
    1
    import { MantineReactTable, useMantineReactTable } from 'mantine-react-table';
    2
    import { columns, data } from './makeData';
    3
    4
    const Example = () => {
    5
    const table = useMantineReactTable({
    6
    columns,
    7
    data,
    8
    enableRowNumbers: true,
    9
    rowNumberMode: 'static', //default
    10
    });
    11
    12
    return <MantineReactTable table={table} />;
    13
    };
    14
    15
    export default Example;
    1
    import { MantineReactTable, useMantineReactTable } from 'mantine-react-table';
    2
    import { columns, data } from './makeData';
    3
    4
    const Example = () => {
    5
    const table = useMantineReactTable({
    6
    columns,
    7
    data,
    8
    enableRowNumbers: true,
    9
    rowNumberMode: 'static', //default
    10
    });
    11
    12
    return <MantineReactTable table={table} />;
    13
    };
    14
    15
    export default Example;

    Enable Row Numbers (Original Mode)

    Alternatively, use the "original" rowNumberMode 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.
    1DylanMurray261 Erdman FordEast DaphneKentucky
    2RaquelKohler769 Dominic GroveColumbusOhio
    3ErvinReinger566 Brakus InletSouth LindaWest Virginia
    4BrittanyMcCullough722 Emie StreamLincolnNebraska
    5BransonFrami32188 Larkin TurnpikeCharlestonSouth Carolina
    1-5 of 5
    1
    import { MantineReactTable, useMantineReactTable } from 'mantine-react-table';
    2
    import { columns, data } from './makeData';
    3
    4
    const Example = () => {
    5
    const table = useMantineReactTable({
    6
    columns,
    7
    data,
    8
    enableRowNumbers: true,
    9
    rowNumberMode: 'original',
    10
    });
    11
    12
    return <MantineReactTable table={table} />;
    13
    };
    14
    15
    export default Example;
    1
    import { MantineReactTable, useMantineReactTable } from 'mantine-react-table';
    2
    import { columns, data } from './makeData';
    3
    4
    const Example = () => {
    5
    const table = useMantineReactTable({
    6
    columns,
    7
    data,
    8
    enableRowNumbers: true,
    9
    rowNumberMode: 'original',
    10
    });
    11
    12
    return <MantineReactTable table={table} />;
    13
    };
    14
    15
    export default Example;
    View Extra Storybook Examples
    You can help make these docs better! PRs are Welcome
    Using Material-UI instead of Mantine?
    Check out Material React Table