Table

Data table with custom cell renderers, loading skeleton, empty state, and optional row click.

Default

EventSeverityRegion
USD/EUR rate spikehighEurope
Supply chain disruptionmediumAsia
Regulatory updatelowNorth America
import { Table, Badge } from '@canarist/ui'

const columns = [
  { key: 'event', header: 'Event' },
  {
    key: 'severity',
    header: 'Severity',
    render: (row) => <Badge variant={row.severity === 'high' ? 'error' : 'warning'}>{row.severity}</Badge>,
  },
  { key: 'region', header: 'Region' },
]

const data = [
  { id: '1', event: 'USD/EUR rate spike', severity: 'high', region: 'Europe' },
  { id: '2', event: 'Supply chain disruption', severity: 'medium', region: 'Asia' },
]

<Table columns={columns} data={data} rowKey={(row) => row.id} />

Loading state

EventSeverityRegion
<Table columns={columns} data={[]} rowKey={(row) => row.id} loading />

Empty state

EventSeverityRegion
No data
<Table columns={columns} data={[]} rowKey={(row) => row.id} />

Reference

PropTypeDefaultDescription
columnsColumn<T>[]Column definitions with key, header, and optional render function.
dataT[]Array of row data.
rowKey(row: T) => stringFunction returning a unique key for each row.
onRowClick(row: T) => voidIf provided, rows become clickable.
loadingbooleanShow animated skeleton rows instead of data.
classNamestringAdditional CSS classes on the outer wrapper.