Heatmap matrix — Charts block
Procharts-heatmap-matrix · for app, analytics pages
Heatmap matrix
A labelled grid with each value written in its shaded cell: cohorts and retention, hours by weekday, when the exact numbers are read
Documentation
Installation
One command copies the block into your project with the shadcn CLI (the registry is set once: Installation).
pnpm dlx shadcn-vue@latest add @trame/charts-heatmap-matrixUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import ChartsHeatmapMatrix from '@/components/trame/blocks/charts/charts-heatmap-matrix.vue'
const props = {
title: "Orders by time slot",
subtitle: "Orders placed on the online store, September 1 to October 12",
columns: [
"9 a.m.",
"10 a.m."
],
rows: [
{
label: "Monday",
cells: [
25,
29
]
},
{
label: "Tuesday",
cells: [
29,
23
]
}
],
scale: {
unit: "orders"
}
}
</script>
<template>
<ChartsHeatmapMatrix v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordsthe grid’s heading ("Room occupancy") |
| subtitle | string | Wordsone line under it: the period, what a cell counts |
| columns* | string[] | Wordsthe second dimension, in its order |
| rows* | Row[] | Datathe measured values, row by row, as the app holds them |
| scale | Scale | Datathe range the shades span |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Row rows[] · 2 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe row’s name ("March cohort", "Tuesday") |
| cells* | (number | null)[] | one value per column, in the columns’ order; null: nothing measured |
Scale scale · 3 props
| Prop | Type | Description |
|---|---|---|
| min | number | the value of the lightest step; the smallest value by default |
| max | number | the value of the darkest step; the largest value by default |
| unit | string | Wordswhat a value counts, after a number ("nights", "orders") |
Options options · 4 props
| Prop | Type | Description |
|---|---|---|
| format | 'number' | 'percent' | 'money' | how a value is written: percent takes 0–100, money cents |
| legend | boolean | shows the low-to-high key; true by default |
| currency | string | DesignISO 4217 for money values, EUR by default |
| mood | 'inverse' | 'brand' | 'warm' | 'tint' | string | a band of the page that redefines the theme surfaces inside it |
What it asks your app for
The block never knows your app: it asks it, through one context provided once, where its links lead, what its actions do, how a price reads and which words to say (The host context).
| Member | What it is for |
|---|---|
| href | the address an action leads to, or null to hide what leads there |
| act | runs a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error } |
| can | whether the page has this action |
| money | formats a price, given in cents |
| cartCount | the cart badge’s number |
| cartDrawer | whether your app has a cart drawer |
| cartOpen | whether the cart drawer is open |
| label | your word for an interface key, or undefined to keep the block’s own |
The words it says itself, in English and French; label(key) replaces any of them:
| Key | English | French |
|---|---|---|
| newsletter.already | You are already subscribed. | Vous êtes déjà inscrit. |
| newsletter.done | Done: you are subscribed. | C’est noté : vous êtes inscrit. |
| newsletter.invalid | Check the email address. | Vérifiez l’adresse e-mail. |
| newsletter.tooMany | Too many attempts, try again in a moment. | Trop de tentatives, réessayez dans un moment. |
Features
- Every word in the server HTML
- Same markup in Vue and React
- Theme tokens only: every theme, light and dark
- Shows what you give it, invents nothing
- No motion; still under reduced motion
- Real buttons and links, a visible focus
- Reads
rowsfrom your app
A charts section, for app, analytics pages.
More charts blocks
- Chart grouped bars: Compare the merchant’s own series side by side within each category on one shared scale.
- Chart line table: a trend over time for two or three series, with its figures beside it in a table.
- Chart ranked bars: categories ranked from the largest as horizontal bars with the value at their end (channels, pages, categories): when the labels are too long to sit under columns.
- Chart stacked area: several series stacked as bands over time so the top edge reads the sum (traffic by source, sales by channel): when the total matters as much as the parts.
- Key metrics featured: The merchant’s own primary metric takes the lead beside a quiet list of supporting measures.
- Key metrics tiles: Centered figures on generous tiles for the merchant’s own headline measures, with context beneath.
- Metric grid ruled grid: an analytics page of the host’s own measures over a chosen period: one ruled grid of chart tiles sharing their borders, the first metric leading at two thirds, each with its value, this period against the previous and an area chart.
- Spend trend stacked bars: a plan with variable spend: three figures and a stacked bar chart of what each period cost.