DataTable

Enhanced table component with built-in sorting, pagination, and striped rows. Accepts generic row types and column definitions with optional custom renderers.

Basic Table

Preview
AgentStatusUptimeRegion
Alpha-7Active99.98%US-East
Bravo-3Standby99.91%EU-West
Charlie-9Active99.95%AP-South
Delta-1Offline87.20%US-West
Echo-5Active99.99%EU-Central

Custom Cell Rendering

Preview
AgentStatusUptimeRegion
Alpha-7Active99.98%US-East
Bravo-3Standby99.91%EU-West
Charlie-9Active99.95%AP-South
Delta-1Offline87.20%US-West
Echo-5Active99.99%EU-Central

DataTable Props

PropTypeDefaultDescription
data*T[]-Array of row objects to display in the table.
columns*DataTableColumn<T>[]-Column definitions specifying how to render each column.
pageSizenumber10Number of rows per page.
stripedbooleantrueWhether to apply alternating row background colors.

DataTableColumn Shape

PropTypeDefaultDescription
key*string-Property key on the row object to read data from.
header*string-Column header text.
sortablebooleanfalseWhether this column can be sorted by clicking the header.
render(value: unknown, row: T) => ReactNode-Custom render function for cell content.
widthstring-CSS width for the column (e.g. "200px").

Accessibility

  • Renders a semantic <table> with <thead> and <tbody>.
  • Sortable column headers are interactive and indicate sort direction with visible arrow indicators.
  • Pagination controls use <button> elements with disabled states.
  • Consider adding aria-sort attributes to sortable headers for screen reader announcements.