Skip to main content
Version: 1.0.3

Table

The Table component displays tabular data with optional sorting, filtering, and pagination. You pass rows and columns as required props; each column can be marked sortable or not. Numeric columns (e.g. ID, marks) are sorted numerically; others are sorted as strings. Filtering is real-time and highlights matching text. This compnent is named as AdvancedTable.

Rows per page:
Showing 1-5 of 12 matching rows (total: 12)Page 1 of 3
ID
Name
Email
Role
Status
1Alice Johnsonalice@example.comAdminActive
2Bob Smithbob@example.comEditorInvited
3Charlie Browncharlie@example.comViewerActive
4Diana Princediana@example.comAdminSuspended
5Ethan Huntethan@example.comEditorActive

Installation

ignix add component advanced-table

Usage

Import the component and pass rows and columns:

import { AdvancedTable, type AdvancedTableRow } from '@site/src/components/UI/advanced-table';

const columns = [
{ key: 'id', label: 'ID', sortable: true },
{ key: 'name', label: 'Name', sortable: true },
{ key: 'email', label: 'Email', sortable: true },
{ key: 'status', label: 'Status', sortable: false },
];

const rows: AdvancedTableRow[] = [
{ id: 1, name: 'Alice', email: 'alice@example.com', status: 'Active' },
{ id: 2, name: 'Bob', email: 'bob@example.com', status: 'Pending' },
];

function MyTable() {
return (
<AdvancedTable
rows={rows}
columns={columns}
enableSorting
enableFiltering
enablePagination
/>
);
}

Base table (no sort, filter, pagination)

Showing 1-12 of 12 matching rows (total: 12)
ID
Name
Email
Role
Status
1Alice Johnsonalice@example.comAdminActive
2Bob Smithbob@example.comEditorInvited
3Charlie Browncharlie@example.comViewerActive
4Diana Princediana@example.comAdminSuspended
5Ethan Huntethan@example.comEditorActive
6Fiona Gallagherfiona@example.comViewerPending
7George Millergeorge@example.comViewerActive
8Hannah Leehannah@example.comAdminActive
9Ian Wrightian@example.comEditorInvited
10Julia Robertsjulia@example.comViewerActive
11Kevin Durantkevin@example.comViewerPending
12Laura Palmerlaura@example.comAdminSuspended

Sortable table

Showing 1-12 of 12 matching rows (total: 12)
ID
Name
Email
Role
Status
1Alice Johnsonalice@example.comAdminActive
2Bob Smithbob@example.comEditorInvited
3Charlie Browncharlie@example.comViewerActive
4Diana Princediana@example.comAdminSuspended
5Ethan Huntethan@example.comEditorActive
6Fiona Gallagherfiona@example.comViewerPending
7George Millergeorge@example.comViewerActive
8Hannah Leehannah@example.comAdminActive
9Ian Wrightian@example.comEditorInvited
10Julia Robertsjulia@example.comViewerActive
11Kevin Durantkevin@example.comViewerPending
12Laura Palmerlaura@example.comAdminSuspended

Filterable table

Showing 1-12 of 12 matching rows (total: 12)
ID
Name
Email
Role
Status
1Alice Johnsonalice@example.comAdminActive
2Bob Smithbob@example.comEditorInvited
3Charlie Browncharlie@example.comViewerActive
4Diana Princediana@example.comAdminSuspended
5Ethan Huntethan@example.comEditorActive
6Fiona Gallagherfiona@example.comViewerPending
7George Millergeorge@example.comViewerActive
8Hannah Leehannah@example.comAdminActive
9Ian Wrightian@example.comEditorInvited
10Julia Robertsjulia@example.comViewerActive
11Kevin Durantkevin@example.comViewerPending
12Laura Palmerlaura@example.comAdminSuspended

Paginated table

Rows per page:
Showing 1-5 of 12 matching rows (total: 12)Page 1 of 3
ID
Name
Email
Role
Status
1Alice Johnsonalice@example.comAdminActive
2Bob Smithbob@example.comEditorInvited
3Charlie Browncharlie@example.comViewerActive
4Diana Princediana@example.comAdminSuspended
5Ethan Huntethan@example.comEditorActive
Rows per page:
Showing 1-5 of 12 matching rows (total: 12)Page 1 of 3
ID
Name
Email
Role
Status
1Alice Johnsonalice@example.comAdminActive
2Bob Smithbob@example.comEditorInvited
3Charlie Browncharlie@example.comViewerActive
4Diana Princediana@example.comAdminSuspended
5Ethan Huntethan@example.comEditorActive

Props

PropTypeDefaultDescription
rowsAdvancedTableRow[]requiredData rows; each row is a record keyed by column keys.
columnsArray<{ key: string; label: string; sortable?: boolean }>requiredColumn definitions. Use sortable: false to disable sorting for that column.
enableSortingbooleantrueWhen true, sortable column headers are clickable and show ↑/↓.
defaultSortKeystringfirst column keyInitial sort column when sorting is enabled.
defaultSortDirection'asc' | 'desc''asc'Initial sort direction.
enableFilteringbooleantrueWhen true, shows filter input and clear button; filters rows and highlights matches.
filterPlaceholderstring'Filter rows...'Placeholder for the filter input.
enablePaginationbooleantrueWhen true, shows rows-per-page selector and page controls.
initialPagenumber1Initial page (1-based).
initialRowsPerPagenumber5Initial rows per page.
rowsPerPageOptionsnumber[][5, 10, 20]Options for the rows-per-page dropdown.
classNamestring-Optional class for the outer container.