Business Table
BusinessTable
Section titled “BusinessTable”BusinessTable is a generic, filterable, paginated table component used broadly across modules (system admin, BusinessManager, PartnersManager, SocialMediaManager, TaskTable, and others).
It is built on shared list/filter primitives:
useListEngineuseListFilterRenderingFilter<T>contracts fromBusinessTable/filters.tsx
Exports
Section titled “Exports”From src/components/BusinessTable/index.tsx:
- default export:
BusinessTable<T extends Record<string, any>>(props) - type
Column<T> - type
FilterGroup(alias ofListFilterGroup)
export type Column<T> = { key: keyof T; label: string; render?: (row: T) => React.ReactNode;};export type FilterGroup = ListFilterGroup;Filter Contracts
Section titled “Filter Contracts”Filters come from src/components/BusinessTable/filters.tsx.
Supported type values:
"text""select""range""dateRange"
Each filter requires:
keylabelplacement("header" | "panel")
Optional metadata:
grouphelpTextdynamic
interface BusinessTableProps<T> { title: string; data: T[]; columns: Column<T>[]; rowKey: keyof T; onSelect?: (id: string) => void; filters?: readonly Filter<T>[]; filterGroups?: readonly FilterGroup[]; actions?: React.ReactNode; loading?: boolean; pageSize?: number; initialFilters?: Record<string, string>;}Prop Notes
Section titled “Prop Notes”rowKey: used for row React key andonSelectid extraction.actions: rendered in the right-side kebab menu (DropdownButton).pageSize:> 0enables pagination footer0/undefined shows all filtered rows
loading: adds top-row loader in table header.initialFilters: initial text/select filter state map.
Behavior
Section titled “Behavior”Filtering
Section titled “Filtering”- Header filters render inline.
- Panel filters render inside
SidePanelButton(“Filters”). - Grouped panel rendering is enabled when
filterGroupsor filtergroupvalues are provided.
Row Selection
Section titled “Row Selection”If onSelect is provided, row click calls:
onSelect(String(row[rowKey]))Empty State
Section titled “Empty State”When filtered data is empty, component renders “No records found”.
Pagination
Section titled “Pagination”Footer appears only when both conditions are true:
pageSize > 0totalPages > 1
Footer includes:
- first/previous buttons
- page indicator
- next/last buttons
- filtered item count
Example
Section titled “Example”import BusinessTable, { type Column, type FilterGroup } from "@/components/BusinessTable";import type { Filter } from "@/components/BusinessTable/filters";
type Partner = { partnerId: number; name: string; status: string; createdAt: string;};
const columns: Column<Partner>[] = [ { key: "name", label: "Partner Name" }, { key: "status", label: "Status" }, { key: "createdAt", label: "Created", render: (row) => new Date(row.createdAt).toLocaleDateString(), },];
const filters: Filter<Partner>[] = [ { type: "text", label: "Search", key: "name", placement: "header", placeholder: "Search partner", }, { type: "select", label: "Status", key: "status", placement: "panel", options: [ { label: "Active", value: "Active" }, { label: "Inactive", value: "Inactive" }, ], group: "status", }, { type: "dateRange", label: "Created Date", key: "createdAt", placement: "panel", group: "dates", },];
const filterGroups: FilterGroup[] = [ { id: "status", label: "Status Filters", order: 1 }, { id: "dates", label: "Date Filters", order: 2 },];
<BusinessTable<Partner> title="Partners" data={partners} columns={columns} rowKey="partnerId" filters={filters} filterGroups={filterGroups} pageSize={20} loading={isLoading} onSelect={(id) => openPartner(id)} actions={<button onClick={openCreate}>Create Partner</button>}/>;When To Use
Section titled “When To Use”Use BusinessTable when you need:
- tabular display with reusable filter controls,
- optional grouped side-panel filters,
- built-in pagination and row click handling.
Use DynamicTable for simpler table rendering with lightweight row-selection behavior.
Use ListEngine when rendering non-table item layouts.
Source Files
Section titled “Source Files”src/components/BusinessTable/index.tsxsrc/components/BusinessTable/filters.tsxsrc/components/ListEngine/useListEngine.tssrc/components/ListEngine/useListFilterRendering.tsx