Matrix
Open in playgroundRow × level grid assessment. Good for capability audits, feature maturity, risk exposure — anything that needs rating across multiple domains on the same scale.
Preview
Usage
import { Matrix } from "@/components/socratic-ui/matrix";
const [value, setValue] = useState<Record<string, number>>({});
<Matrix
question="Rate your team's capabilities"
rows={[
{ id: "frontend", title: "Frontend" },
{ id: "backend", title: "Backend" },
]}
levels={["None", "Basic", "Solid", "Expert"]}
value={value}
onChange={setValue}
/>
API Reference
| Prop | Type | Default |
|---|---|---|
questionrequiredThe headline shown above the matrix. | string | — |
subtitleOptional supporting copy beneath the question. | string | — |
rowsrequiredEach row is an independently-rated dimension. | { id: string; title: string; subtitle?: string }[] | — |
levelsrequiredOrdered level labels from low (index 0) to high. Picking a level fills it and every level below, like a progress bar. | string[] | — |
valuerequiredMap of row id to the selected 0-based level index. | Record<string, number> | — |
onChangerequiredCalled whenever a row's level changes. | (value: Record<string, number>) => void | — |
numberOptional leading question number, e.g. "01". | string | — |
motionOpt-in entrance animation config. Omit for static rendering; pass `{ enabled: true }` (or a preset from `motion.ts`) to animate in on mount. | SocraticMotion | — |