Factory Machine Status

111213141516171819202122232425262728293031123456789
M-01
M-02
M-03
M-04
M-05
M-06
M-07
M-08
M-09
M-10
Operational(171)
Warning(63)
Fault(37)
No data(29)
111213141516171819202122232425262728293031123456789
M-01
M-02
M-03
M-04
M-05
M-06
M-07
M-08
M-09
M-10

StatusMap

A grid-based heatmap that maps status values to colored cells across rows and dates.

Usage

import { StatusMap } from "@/components/ui/status-map"

<StatusMap
  data={data}
  labelConfig={{
    green:  { color: "bg-emerald-500", label: "Operational" },
    orange: { color: "bg-orange-400",  label: "Warning", enableAction: true },
    red:    { color: "bg-orange-700",  label: "Fault",   enableAction: true },
    grey:   { color: "bg-muted",       label: "No data" },
  }}
  onAction={(row, date, status) => console.log(row, date, status)}
  label
  labelAlign="right"
  labelTop={false}
  style="rounded"
/>

Props

PropTypeDefaultDescription
data*StatusMapEntry[]Array of entries, each with a row label, ISO date, and status key.
labelConfig*Record<string, StatusItemConfig>Maps status keys to a Tailwind color class, human-readable label, and optional enableAction flag.
style"rounded" | "squared" | "tight""rounded"Cell shape style.
borderedbooleantrueAdds a border around the grid.
labelbooleanfalseShows the color legend below (or above) the grid.
labelAlign"left" | "center" | "right""left"Horizontal alignment of the legend.
labelTopbooleanfalseRenders the legend above the grid instead of below.
classNamestringAdditional class names applied to the root element.
onCellClick(row, date, status) => voidCallback fired on every cell click.
onAction(row, date, status) => voidCallback fired when a cell whose status has enableAction: true is clicked.
tooltipbooleanfalseShows a tooltip on cell hover.
tooltipContent(row, date, status, label) => ReactNodeCustom tooltip renderer.