DynamicTable
DynamicTable is the core data presentation component of antd-dynamic-ui. Instead of declaring repetitive JSX Column tags, you supply a declarative JSON schema. DynamicTable natively supports 8 composite cell types (IMAGE, LINK, TEXT, STATUS, DYNAMIC_FORM, ACTION, MODAL, CUSTOM), adaptive virtualization threshold (>50 rows) for 60fps scrolling, server-side pagination (offset and cursor), and seamless integration with FilterDrawer, ColumnDrawer, and DownloadModal.
Props & Configuration
8 propsComplete property specifications, parameter types, and default fallbacks.
| Property | Type | Default | Description |
|---|---|---|---|
| apiDataRequired | ApiDataType | — | Remote endpoint configuration containing apiUrl, apiType ('get' | 'post'), default params, and body. |
| filterKeyRequired | string | — | Unique identifier connecting this table to Zustand filter state and DynamicHeader / FilterDrawer. |
| paginationType | "offset" | "cursor" | "offset" | Controls whether pagination sends page/limit or nextCursor tokens. |
| border | boolean | true | Toggles outer container border and subtle row divider lines. |
| refreshTrigger | number | 0 | Incrementing numeric counter that forces the table to re-query the remote API immediately. |
| onActionClick | (data: { actionKey: string; record: any }) => void | — | Callback triggered whenever an ACTION cell, row menu item, or button is clicked. |
| className | string | — | Custom CSS class for the outermost table container. |
| rowKey | string | ((record: any) => string) | "id" | Unique key field identifier for rows (defaults to 'id'). |
Interactive Examples & Live Previews
3 DemosEvery example includes its own live, interactive preview element alongside the corresponding copyable TypeScript snippet.
Basic Remote API Grid
Quickstart configuration connecting DynamicTable to a paginated REST endpoint.
101 | Alexander Wright alex.wright@corp.io | Superadmin | Active | 2026-01-15 |
102 | Sophia Martinez sophia.m@corp.io | Product Mgr | Active | 2026-02-01 |
103 | Marcus Chen m.chen@corp.io | Developer | Pending | 2026-02-14 |
104 | Emma Watson emma.w@corp.io | Designer | Suspended | 2026-03-02 |
- Showing 1 to 4 of 4 entries
- 1
1import React from "react";2import { DynamicTable } from "antd-dynamic-ui";34export default function OrdersTable() {5 return (6 <div className="p-6">7 <h2 className="text-xl font-bold mb-4">Customer Orders</h2>8 <DynamicTable9 apiData={{10 apiUrl: "/api/v1/orders",11 apiType: "get",12 params: { department: "logistics" },13 }}14 filterKey="orders_grid"15 border={true}16 onActionClick={(action) => {17 console.log("User clicked row action:", action);18 }}19 />20 </div>21 );22}
Complete Props & Composite Cells
Enterprise setup utilizing cursor pagination, refresh counter, action event delegation, and all props.
101 | Alexander Wright alex.wright@corp.io | Superadmin | Active | 2026-01-15 | |
102 | Sophia Martinez sophia.m@corp.io | Product Mgr | Active | 2026-02-01 | |
103 | Marcus Chen m.chen@corp.io | Developer | Pending | 2026-02-14 | |
104 | Emma Watson emma.w@corp.io | Designer | Suspended | 2026-03-02 |
- Showing 1 to 4 of 4 entries
- 1
1import React, { useState } from "react";2import { DynamicTable, DynamicHeader } from "antd-dynamic-ui";3import { message, Modal } from "antd";45export default function EnterpriseUsersGrid() {6 const [refreshCount, setRefreshCount] = useState(0);78 const handleActionClick = (actionData: any) => {9 const { actionKey, record } = actionData;10 if (actionKey === "DELETE_USER") {11 Modal.confirm({12 title: "Delete User",13 content: `Are you sure you want to delete ${record?.name}?`,14 onOk: async () => {15 message.success("User deleted successfully");16 setRefreshCount((prev) => prev + 1); // Triggers table reload17 },18 });19 } else if (actionKey === "VIEW_PROFILE") {20 window.location.href = `/users/${record?.id}`;21 }22 };2324 return (25 <div className="space-y-4">26 {/* DynamicHeader automatically syncs search & refresh with filterKey */}27 <DynamicHeader28 filterKey="enterprise_users_grid"29 title="Enterprise Accounts"30 subTitles={["System Administration", "Active Tenants"]}31 searchPlaceholder="Search accounts by name, email, or domain..."32 onRefresh={() => setRefreshCount((c) => c + 1)}33 />3435 <DynamicTable36 apiData={{37 apiUrl: "/api/v2/tenants/directory",38 apiType: "post",39 body: { region: "us-east-1", activeOnly: true },40 }}41 filterKey="enterprise_users_grid"42 paginationType="cursor"43 border={true}44 refreshTrigger={refreshCount}45 onActionClick={handleActionClick}46 className="shadow-sm rounded-xl"47 />48 </div>49 );50}
StaticTable with In-Memory Mock Data
Using StaticTable for zero-network testing, offline storybooks, and local mock datasets.
001 | Sarah Connor sarah@resistance.org | Commander | Active |
002 | John Doe john@tech.io | Engineer | Active |
- Showing 1 to 2 of 2 entries
- 1
1import React from "react";2import { StaticTable, TableColumnType, TableDataType } from "antd-dynamic-ui";34const MOCK_COLUMNS: TableColumnType[] = [5 { id: "id", title: "ID", width: 80, sortable: true },6 { id: "user", title: "User Profile", minWidth: 200 },7 { id: "role", title: "Access Role", width: 140 },8 { id: "status", title: "Account Status", width: 130 },9];1011const MOCK_DATA: TableDataType = {12 columns: MOCK_COLUMNS,13 rows: [14 {15 id: [{ type: "TEXT", title: "101", isBold: true }],16 user: [17 { type: "IMAGE", src: "https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=100", width: 36, height: 36, shape: "circle", isPreview: true },18 { type: "TEXT", title: "Alexander Wright", subTitle: "alex@corp.io", isBold: true },19 ],20 role: [{ type: "STATUS", title: "Superadmin", bgColor: "#eff6ff", textColor: "#1d4ed8" }],21 status: [{ type: "STATUS", title: "Active", bgColor: "#ecfdf5", textColor: "#047857" }],22 },23 ],24 features: { search: true, sort: true, export: true, refresh: true, columnToggle: true },25 isPaginated: true,26 pageNumber: 1,27 pageSize: 10,28 totalPages: 1,29 totalRows: 1,30 count: 1,31};3233export default function OfflineTableDemo() {34 return (35 <StaticTable36 staticData={MOCK_DATA}37 border={true}38 pagination={true}39 filterKey="offline_demo"40 onActionClick={(action) => alert(JSON.stringify(action))}41 />42 );43}
Expected Backend API Response Schema
Ensure your backend endpoint returns JSON matching this exact structure to prevent hydration and rendering errors.
Expected API Response Payload
Your backend API must return JSON matching this exact structure.
{
"success": true,
"message": "Data retrieved successfully",
"data": {
"columns": [
{
"id": "id",
"title": "ID",
"width": 80,
"sortable": true
},
{
"id": "user",
"title": "User Profile",
"minWidth": 200
},
{
"id": "role",
"title": "Role",
"width": 140
},
{
"id": "status",
"title": "Status",
"width": 130
}
],
"rows": [
{
"id": [
{
"type": "TEXT",
"title": "101",
"isBold": true
}
],
"user": [
{
"type": "TEXT",
"title": "Alexander Wright",
"subTitle": "alex@corp.io"
}
],
"role": [
{
"type": "STATUS",
"title": "Superadmin",
"bgColor": "#eff6ff",
"textColor": "#1d4ed8"
}
],
"status": [
{
"type": "STATUS",
"title": "Active",
"bgColor": "#ecfdf5",
"textColor": "#047857"
}
]
}
],
"features": {
"search": true,
"sort": true,
"export": true,
"refresh": true,
"columnToggle": true
},
"isPaginated": true,
"pageNumber": 1,
"pageSize": 10,
"totalPages": 1,
"totalRows": 1,
"count": 1
}
}Frequently Asked Questions & Quick Solutions
Architectural patterns, React 19 compatibility, and integration tips for DynamicTable.
How does DynamicTable integrate with Ant Design 5.x and Next.js 15?▼
DynamicTable is designed as an enhanced, declarative wrapper for Ant Design. It fully supports Next.js 15 App Router when using @ant-design/nextjs-registry, eliminating SSR hydration mismatches and guaranteeing 0ms layout thrashing.
Can I customize validation, themes, and props for DynamicTable?▼
Yes. Every prop is fully typed in TypeScript 5 with comprehensive Intellisense. You can pass custom styling via className or style props, configure global Ant Design themes via ConfigProvider, and extend validation logic seamlessly.