Edit page


Table presents complex tabular data in an easy-to-scan way.

Basic Usage

To implement the Table component, you need to import it first:

import { Table } from '@react-ui-org/react-ui';

And use it:

See API for all available options.

General Guidelines

  • Keep headers short so users can quickly scan the content of the table. Just one or two words should be enough.

  • Tables are good for displaying complex tabular data. For simpler data sets or even plain key-value pairs, consider using the Grid component.

  • Tables make lots of information easier to scan and compare. If you have fewer sections and want to emphasize each group more, consider using Cards.

Responsive Tables

The easiest way to make tables responsive is to wrap them with the ScrollView component in the horizontal mode.

Sortable Columns

The Table supports sorting indicators by adding a simple configuration.

⚠️ The Table component only provides necessary visual support for sorting. Aside from icons, you must provide the comparing functionality yourself if you aren't rendering already sorted data. The reason for this decision is that client often does not have access to the full dataset.

The following is an example of custom sorting function executed on the client.

Forwarding HTML Attributes

In addition to the options below in the component's API section, you can specify React synthetic events or any HTML attribute you like. All attributes that don't interfere with the API are forwarded to the <table> HTML element. This enables making the component interactive and helps to improve its accessibility.

👉 Refer to the MDN reference for the full list of supported attributes of the table element.


Prop nameTypeDefaultRequiredDescription
columnsArray<{ "format": "Function", "isSortable": "Boolean", "label": "string", "name": "string" }>true

Table data columns, optionally sortable. The format function can be used to process the column data before displaying them.


ID of the root HTML element. It also serves as base for nested elements:

  • <ID>__headerCell__<COLUMN_NAME>
  • <ID>__headerCell__<COLUMN_NAME>__sortButton
  • <ID>__bodyCell__<COLUMN_NAME>__<ROW_ID>

Table data rows, each object key must match a column name

sort{ "ascendingIcon": "node", "column": "string", "descendingIcon": "node", "direction": "'asc' │ 'desc'", "onClick": "Function" }nullfalse

Sorting configuration required to make columns sortable.