DocsGitHub
Getting Started
  • Overview
  • Design Tokens
Components
  • Accordion
  • Alert
  • Announcement
  • Avatar
  • Badge
  • BigCalendar
  • Breadcrumb
  • Button
  • ButtonGroup
  • Calendar
  • Card
  • Checkbox
  • Chip
  • CloseButton
  • Combobox
  • CommandPalette
  • ContextMenu
  • Currency
  • DatePicker
  • DescriptionList
  • Drawer
  • DropdownMenu
  • EmptyState
  • Field
  • FileUpload
  • FormGrid
  • Hotkey
  • Icon
  • Input
  • Metric
  • Modal
  • MultiSelect
  • NumberInput
  • Pagination
  • Popover
  • ProgressBar
  • Radio
  • Rating
  • SegmentedControl
  • Select
  • SelectionCard
  • Sidebar
  • Skeleton
  • Slider
  • Spinner
  • Stepper
  • Switch
  • Table
  • Tabs
  • Textarea
  • Timeline
  • TimePicker
  • Toast
  • Tooltip
  • TransferList
  • TreeView
  • Wizard
Charts
  • Overview
  • Area Chart
  • Bar Chart
  • Donut Chart
  • Line Chart
  • Pie Chart
  • Stacked Bar Chart

Table

A compound table and typed ERP data grid with paging, column controls, expansion, virtualization, editing, resizing, and reordering.

Installation

tsx
import { Table, type TableColumn, TableHead, TableBody, TableRow, TableHeaderCell, TableCell, TableBulkActions } from "madagent";

Default

NameEmailRoleStatus
Alice Johnsonalice@example.comAdminActive
Bob Smithbob@example.comEditorActive
Carol Williamscarol@example.comViewerInactive
David Browndavid@example.comEditorActive
Eve Daviseve@example.comAdminActive

Striped

NameEmailRole
Alice Johnsonalice@example.comAdmin
Bob Smithbob@example.comEditor
Carol Williamscarol@example.comViewer
David Browndavid@example.comEditor
Eve Daviseve@example.comAdmin

Compact Density

NameEmailRole
Alice Johnsonalice@example.comAdmin
Bob Smithbob@example.comEditor
Carol Williamscarol@example.comViewer
David Browndavid@example.comEditor
Eve Daviseve@example.comAdmin

Tabular Numbers

ItemSubtotalTax (14%)Total
Annual subscriptionE£18,000.00E£2,520.00E£20,520.00
Setup feeE£2,500.00E£350.00E£2,850.00
Training workshopE£4,800.00E£672.00E£5,472.00
Priority supportE£7,200.00E£1,008.00E£8,208.00

Sortable Columns

Email
Status
Alice Johnsonalice@example.comAdminActive
Bob Smithbob@example.comEditorActive
Carol Williamscarol@example.comViewerInactive
David Browndavid@example.comEditorActive
Eve Daviseve@example.comAdminActive

Bulk Actions

DateTeam MemberStatusAmountExpense CategoryReceipt
Feb 16Jane BlackPayment Pending$50.25Travel - Vehicles—
Feb 16Jane BlackPending Review$16.75Travel - Vehicles—
Feb 14Jane BlackDeclined$35.00Travel - FlightsUploaded
Feb 14Mary MetcalfeDetails Requested$480.50Travel - FlightsUploaded
Oct 1Fiona LauricePending Review$215.78Travel - Accommodation—

0 requests selected • $0.00 total

Typed data grid

Expand
SKU⋮⋮
Product⋮⋮
On hand⋮⋮
Warehouse⋮⋮
SKU-0001Inventory item 120Cairo
SKU-0002Inventory item 222Alexandria
SKU-0003Inventory item 324Cairo
SKU-0004Inventory item 426Alexandria
SKU-0005Inventory item 528Cairo
SKU-0006Inventory item 630Alexandria
1–6 of 36

Virtualized rows

SKU
Product
On hand
Warehouse
SKU-0001Virtual inventory item 120Cairo
SKU-0002Virtual inventory item 222Alexandria
SKU-0003Virtual inventory item 324Cairo
SKU-0004Virtual inventory item 426Alexandria
SKU-0005Virtual inventory item 528Cairo
SKU-0006Virtual inventory item 630Alexandria
SKU-0007Virtual inventory item 732Cairo
SKU-0008Virtual inventory item 834Alexandria
SKU-0009Virtual inventory item 936Cairo
SKU-0010Virtual inventory item 1038Alexandria
SKU-0011Virtual inventory item 1140Cairo
SKU-0012Virtual inventory item 1242Alexandria
SKU-0013Virtual inventory item 1344Cairo
SKU-0014Virtual inventory item 1446Alexandria
SKU-0015Virtual inventory item 1548Cairo
SKU-0016Virtual inventory item 1650Alexandria
SKU-0017Virtual inventory item 1752Cairo
SKU-0018Virtual inventory item 1854Alexandria
SKU-0019Virtual inventory item 1956Cairo

Loading and empty states

SKU
Product
On hand
Warehouse
SKU
Product
On hand
Warehouse
No inventory records
Adjust filters or add the first item.

Table Props

PropTypeDefaultDescription
striped
boolean
falseAlternating row background colors
density
"compact""comfortable"
"comfortable"Cell padding density
stickyHeader
boolean
falseSticky table header on scroll
columns
TableColumn<TRow>[]
-Enables the typed data-driven API while compound children remain supported
rows
TRow[]
-Records rendered by the typed data API
getRowId
(row, index) => stringnumber
-Stable row identity; defaults to row.id or the row index
pagination
TablePaginationConfig
-Page size, controlled/uncontrolled page state, server totals, and page-window options
columnVisibility
Record<string, boolean>
-Controlled column visibility map
showColumnsMenu
boolean
trueShows a Checkbox-backed visibility menu when columns are hideable
onRowClick
(row, event) => void
-Called when a data row is activated with the pointer
expandableRows
boolean(row) => boolean
falseEnables logical row expansion controls
renderExpanded
(row) => ReactNode
-Renders the full-width expanded row panel
loading
boolean
falseReplaces rows with semantic Skeleton rows and marks the table busy
virtualized
{ rowHeight; height?; overscan? }
-Fixed-height row windowing for large datasets with focus restoration
onCellEdit
(rowId, columnId, value, row) => void
-Receives Enter-committed inline edits; Escape cancels
resizableColumns
boolean
falseEnables pointer and keyboard resize handles for every column
reorderableColumns
boolean
falseEnables drag reorder and logical Alt+Arrow keyboard reorder

TableColumn

PropTypeDefaultDescription
id*
string
-Stable column identifier
header*
ReactNode
-Header content
accessor
keyof TRow(row) => unknown
-Reads the raw cell value
cell
(value, row, index) => ReactNode
-Formats display content
align
"start""center""end"
-Logical text alignment
width / minWidth / maxWidth
numberstring
-Column sizing constraints; numeric sticky widths give deterministic offsets
sticky
"start""end"
-Pins the column to a logical table edge
hideable
boolean
-Adds the column to the visibility menu
editable
boolean(row) => boolean
-Starts an editor with Enter or double-click
renderEditor
(editorProps) => ReactNode
-Uses a custom madagent editor instead of the default text input
resizable
boolean
-Enables the column resize separator
reorderable
boolean
-Enables drag and Alt+Arrow reorder for this column

HeaderCell Props

PropTypeDefaultDescription
sortable
boolean
falseShow sort controls
sortDirection
"asc""desc""none"
"none"Current sort direction
onSort
(direction: SortDirection) => void
-Called when a sort option is selected from the dropdown
sortAscLabel
string
"Ascending"Label for the ascending sort option
sortDescLabel
string
"Descending"Label for the descending sort option
clearSortLabel
string
"Clear sort"Label for the clear sort option

BulkActions Props

PropTypeDefaultDescription
selectedRowIds
(string | number)[]
-IDs currently selected in the table
actions
TableBulkAction[]
-Action buttons rendered inside the bulk action bar
onAction
(actionId: string, selectedRowIds: (string | number)[]) => void
-Called when any bulk action button is clicked
onClearSelection
() => void
-Optional callback to clear selected rows
summary
ReactNode
-Optional summary content (for example selected total amount)
hideWhenEmpty
boolean
trueHide the bulk actions bar when there are no selected rows

RTL Support

Components automatically adapt to right-to-left languages using CSS logical properties.

Preview

الاسمالبريد الإلكترونيالمبلغالمسمى الوظيفي
يوسف يعقوبahmed@example.com3842مصمم تطبيقات
فاطمة عليfatima@example.com1597مهندس صوت
خالد حسنkhaled@example.com7260مدير التسويق

2 عناصر محددة

Tabular Numbers

البندالمبلغالضريبة (15%)الإجمالي
اشتراك سنوي18,000.00⃁2,700.00⃁20,700.00⃁
رسوم التفعيل2,500.00⃁375.00⃁2,875.00⃁
ورشة تدريبية4,800.00⃁720.00⃁5,520.00⃁
دعم فني متقدم7,200.00⃁1,080.00⃁8,280.00⃁

Usage

tsx
<Table>
  <TableHead>
    <TableRow>
      <TableHeaderCell style={{ width: 52 }}>
        <Checkbox aria-label="تحديد الكل" />
      </TableHeaderCell>
      <TableHeaderCell>الاسم</TableHeaderCell>
      <TableHeaderCell>البريد الإلكتروني</TableHeaderCell>
      <TableHeaderCell>المبلغ</TableHeaderCell>
      <TableHeaderCell>الدور</TableHeaderCell>
    </TableRow>
  </TableHead>
  <TableBody>
    <TableRow>
      <TableCell><Checkbox /></TableCell>
      <TableCell>أحمد محمد</TableCell>
      <TableCell>ahmed@example.com</TableCell>
      <TableCell>3842</TableCell>
      <TableCell>مشرف</TableCell>
    </TableRow>
  </TableBody>
</Table>
<TableBulkActions
  selectedRowIds={selectedRowIds}
  actions={[
    { id: "approve", label: "اعتماد", variant: "primary" },
    { id: "decline", label: "رفض", variant: "danger" },
  ]}
  onClearSelection={() => setSelectedRowIds([])}
  summary={`${selectedRowIds.length} عناصر محددة`}
/>