• /
  • Log in


Renders a table with a fixed header and rows. The table implements the following features:

  • Flexible layout: table headers accept a variety of sizes to enable fluid and fixed layouts. You can find more information on how to customize your columns checking TableHeaderCell.

  • Sorting: items passed can be internally sorted by the table according to the current sorting state of the table. You can find more information about sorting by checking TableHeaderCell.

  • Row selection: rows can be selected through checkboxes on the right hand side. You can find more information in the selected prop.

  • Row actions: contextual actions can be triggered per row, enabling users to achieve functionality over them. You can find more information on how to add them in TableRow.

  • Custom pre-defined cells: some very common patterns for cells (entity title, metrics, etc.) are already provided by the platform, so that you only need to return it as part of your row.

  • Virtualization: cells are only rendered if they are shown on screen. This enables the table to work with a large dataset with almost no performance penalty.


import { Table } from 'nr1'




Provide an accessibility label that describes the purpose of the table, e.g. "All entities".


Contents of the table. Table can only contain as children <TableHeader> and a function returning <TableRow>s.


Appends class names to the component.

Should be used only for positioning and spacing purposes.


Establishes whether the table should render in compact mode (compact mode has narrower rows). In general, use the standard mode, since compact is reserved for data representation, e.g. in a dashboard.


The items to be used when rendering.

They are required when rendering items with a render callback.

Each item can have any structure and type possible, and will the corresponding one will be provided when rendering each element list.


Column containing the main data identifying the row. Often the first column (index 0) is the relevant one, but actions (like favorites) could be placed before it.


Callback fired when more items must be loaded. This happens when you're lazy loading the items and the items that are about to render cannot be found in the items array.

This callback should be used to fetch/load the missing items from the backend or other sources.

The returned Promise should be resolved once item data has finished loading. It will be used to determine when to refresh the list with the newly-loaded data. This callback may be called multiple times in reaction to a single scroll event.

function (
cursor: Cursor //

Items to load.


Function called when the user clicks over a row checkbox.

It is called with the event of the checkbox, as well as with an object containing the item representing the row, its index in the items array passed to the table, and the items themselves.

When the user selects or unselects the header checkbox (select / unselect all), the callback will be called once for every item, representing individual clicks over each row. The header checkbox state is automatically controlled by the table.

function (
event: React.ChangeEvent,
selectedItem: SelectedCallbackArgument

Number of rows.

By default it's equal to length of array passed in the items prop.

You should specify the rowCount when you know the total number of items but you want to lazy load them while scrolling.


Function that returns whether a row is selected. It needs to return a boolean representing the state of the row.

It is called with an object containing the item representing the row, its index in the items array passed to the table, and the items themselves.

function (
item: SelectedCallbackArgument
) => boolean

Sets the selection mode of the Table. Use it along with onSelect and selected props to determine which row is checked by the user.

  • Table.SELECTION_TYPE.BULK displays checkboxes per each row, along with a checkbox in the header to select all items. When an item is selected, header actions become available.

  • Table.SELECTION_TYPE.SINGLE doesn't display checkboxes, the user picks a row by just clicking on it. Though not enforced in the component, the selected callback should return true only for one item. Check the examples of the component to see how it works.

<One of

Spacing property. Spacing is defined as a tuple of zero to four values, which follow the same conventions as CSS properties like margin or padding. To omit a value, use SPACING_TYPE.OMIT.

<Array of
<One of

Inline style for custom styling.

Should be used only for positioning and spacing purposes.


Adds a data-test-id attribute.

Use it to target the component in unit and e2e tests.

Type definitions


startIndex: number, //

First index of the range of items to load.

stopIndex: number, //

Last index of the range of items to load.



item: any, //

Item to check.

index: number, //

Index of the item in the items array.

items: any[], //

Array of all items passed.

Create issueEdit page
Copyright © 2021 New Relic Inc.