Skip to content

@maxhealth.tech/prefab / auto / autoTable

Function: autoTable()

ts
function autoTable(rows, options?): ContainerComponent;

Defined in: auto/index.ts:267

Auto-generate a DataTable from an array of objects.

Infers columns from the first row's keys, skipping nested objects/arrays. Wraps in a Column with a title and record count badge.

Parameters

ParameterType
rowsRecord<string, unknown>[]
options?AutoTableOptions

Returns

ContainerComponent

Example

ts
autoTable([
  { name: 'John', email: 'john@example.com', age: 30 },
  { name: 'Jane', email: 'jane@example.com', age: 25 },
], { title: 'Users' })

Released under the MIT License.