Prometheus Design System v0.2.0 — WIP

KeyValueTable

Two-column key-value display table for build info, runtime info, and configuration flags.

Description

Two-column key-value display table for build info, runtime info, and configuration flags. A lightweight alternative to DataTable for simple key-value pair display.

✓ Do
  • Two-column key-value display (build info, runtime, flags)
  • Pass a plain object for simple cases
  • Lightweight alternative to DataTable
✗ Don’t
  • Multi-column or sortable data (use DataTable)
  • Large datasets
  • Custom two-column table layouts

Design

KeyValueTable Example
Version2.47.0
Revisionabc123def
Go Versiongo1.21.5
Build Date2024-01-15
Where this component exists in the Prometheus UI
View in Prometheus UI → /targets KeyValueTable inside expanded target — label key-value pairs

KeyValueTable inside expanded target — label key-value pairs

View in Prometheus UI → /service-discovery KeyValueTable in Service Discovery — discovered labels

KeyValueTable in Service Discovery — discovered labels

Implementation

From pages/FlagsPage.tsx in the Prometheus codebase:

<Table horizontalSpacing="md" verticalSpacing="xs" miw={700} layout="fixed">
  <Table.Tbody>
    <Table.Tr>
      <Th sorted={sortBy === "flag"} reversed={reverseSortDirection}
          onSort={() => setSorting("flag")}>Flag</Th>
      <Th sorted={sortBy === "value"} reversed={reverseSortDirection}
          onSort={() => setSorting("value")}>Value</Th>
    </Table.Tr>
  </Table.Tbody>
  <Table.Tbody>
    {sortedData.map((row) => (
      <Table.Tr key={row.flag}>
        <Table.Td><code>--{row.flag}</code></Table.Td>
        <Table.Td><code>{row.value}</code></Table.Td>
      </Table.Tr>
    ))}
  </Table.Tbody>
</Table>

Layout Specs

PropertyValue
Cell Padding6px 12px (0.375rem 0.75rem)
Border Bottom1px solid
Font Size13px
Key Column Width40%
Key Font Weight600 (semibold)

Accessibility