Prometheus Design System v0.2.0 — WIP

DataTable

Generic sortable data display table.

Description

Generic sortable data display table. Supports custom cell rendering, column sorting, empty states, and horizontal scroll. Used throughout Prometheus UI for flags, statistics, and tabular data display.

✓ Do
  • All tabular data (flags, stats, TSDB info)
  • Sortable columns with visual sort indicators
  • Use column render for custom cells, rowKey for stable keys
✗ Don’t
  • Key-value pair display (use KeyValueTable)
  • Complex interactive grids with editing
  • Custom <Table> layouts with manual sort logic

Design

DataTable Example
Flag ↕Value
--config.file/etc/prometheus/prometheus.yml
--storage.tsdb.path/data
--storage.tsdb.retention.time15d
--web.listen-address0.0.0.0:9090

DataTableColumn Interface

PropertyTypeDescription
keystringColumn key / accessor
headerReact.ReactNodeColumn header label
render(row: T, index: number) => ReactNodeCustom cell renderer
sortablebooleanWhether this column is sortable
align"left" | "center" | "right"Column alignment
truncatebooleanWhether to truncate long values
Where this component exists in the Prometheus UI
View in Prometheus UI → /flags DataTable on the Flags page — sortable table with flag values

DataTable on the Flags page — sortable table with flag values

View in Prometheus UI → /tsdb-status DataTable on the TSDB Status page — top 10 metrics

DataTable on the TSDB Status page — top 10 metrics

Implementation

From pages/targets/ScrapePoolsList.tsx in the Prometheus codebase:

<Table>
  <Table.Thead>
    <Table.Tr>
      <Table.Th w="25%">Endpoint</Table.Th>
      <Table.Th>Labels</Table.Th>
      <Table.Th w={230}>Last scrape</Table.Th>
      <Table.Th w={100}>State</Table.Th>
    </Table.Tr>
  </Table.Thead>
  <Table.Tbody>
    {items.map((target, i) => (
      <Table.Tr key={i}>
        <Table.Td>
          <EndpointLink endpoint={target.scrapeUrl} globalUrl={target.globalUrl} />
        </Table.Td>
        <Table.Td>
          <TargetLabels labels={target.labels} />
        </Table.Td>
        <Table.Td>
          <Badge className={healthBadgeClass(target.health)}>{target.health}</Badge>
        </Table.Td>
      </Table.Tr>
    ))}
  </Table.Tbody>
</Table>

Layout Specs

PropertyValue
Cell Padding6px 12px (0.375rem 0.75rem)
Header Padding8px 12px (0.5rem 0.75rem)
Header Border Bottom2px solid
Cell Border Bottom1px solid
Font Size12px (xs) default
Header Font Size11px
Min Heightauto (content-driven)

Accessibility