Skip to main content

Table: React

A table is used to organise and display tabular data in a way that's easy to scan.

Installation

Before you can start using the @mediahuis/chameleon-react component, you’ll need to install it, for more information check: Getting started for developers.

With that done, you’re now ready to implement the component in your application.

import { Table } from '@mediahuis/chameleon-react';

export default function Example() {
return (
<Table
columns={[{ title: 'Examples', field: 'exampleProp' }]}
data={[
{
exampleProp: 'Example',
},
]}
/>
);
}

Properties

PropertyTypeDefaultRequiredDescription
columnsArray-NoColumns displayed in the table.
dataArray-NoRows displayed in the table.
emptyDescriptionString-YesThe description displayed when the table is empty.
emptyIconReactNodeSearchNoThe icon displayed when the table is empty.
loadingBoolean-NoShow a loading state (e.g., while fetching data).
sortingBoolean-NoDefines if the table can be sortable.
tableLayout'auto' | 'fixed' | 'inherit''auto'NoDefines the algorithm used to lay out table cells, rows, and columns. Can be used to force a cell's width.