Extending
Custom statuses
To add statuses of your own, pass statuses with the default ones and yours:
ts
import { defaultStatuses, defineMatrix } from "vitepress-comparison"
import deprecated from "./icons/deprecated.svg?raw"
import removed from "./icons/removed.svg?raw"
export const matrix = defineMatrix({
statuses: {
...defaultStatuses,
deprecated: { label: "Deprecated", icon: deprecated, color: "var(--vp-c-purple-1)" },
removed: { label: "Removed", icon: removed, color: "var(--vp-c-red-1)", requiresHref: true },
},
projects: [...],
groups: [...], // cells: { other: "deprecated" }
})The matrix shows them in its cells and legend:
| Feature | Kvik2.4.0 | Acme Store5.1.2 | Globex DB0.18.3 |
|---|---|---|---|
| #Client API | |||
- Supported
- Not supported
- Not reviewed yet
- Deprecated
- Removed
Each status has:
label: its name in the legend and in the popovers of its cells.icon: the SVG markup of its icon, which the matrix draws 18 pixels wide. Give the SVG aviewBoxand draw it withcurrentColor, so that it takescolor.color: the CSS color of its icon.requiresHref: whentrue, each cell of the status setshref, asdeclineddoes.
The legend lists the statuses that the cells take, in the order of their keys. To override a default status, spread its definition and change its fields, such as supported: { ...defaultStatuses.supported, label: "Yes" }. To leave out default statuses, list the ones you keep, such as unknown: defaultStatuses.unknown, instead of spreading them all. Keep unknown: a project without a cell takes it.
To share a set between matrices, declare it with satisfies StatusDefinitions, so that types still require href in the cells of a status with requiresHref: true.