# Heatmap

A grid of days, a column for each week, each day shaded by how much happened, with the months above, a summary and a scale from less to more.

Block: `smbk-heatmap`. Status: experimental. Figma: the Figma file, https://www.figma.com/community/file/1688324308358870630. Desktop and mobile: differ by presentation only.

## Options

| Axis | Values | Default | Meaning |
|---|---|---|---|

Parts: `smbk-heatmap__chart`, `smbk-heatmap__weekdays`, `smbk-heatmap__weekday`, `smbk-heatmap__week`, `smbk-heatmap__month`, `smbk-heatmap__month-name`, `smbk-heatmap__cell`, `smbk-heatmap__legend`, `smbk-heatmap__summary`, `smbk-heatmap__scale`, `smbk-heatmap__scale-word`, `smbk-heatmap__table`, `smbk-heatmap__hidden`

## Markup

```html
<div class="smbk-heatmap">
  <div class="smbk-heatmap__chart" aria-hidden="true">
    <div class="smbk-heatmap__weekdays">
      <span class="smbk-heatmap__month"></span>
      <span class="smbk-heatmap__weekday">Mon</span>
      <span class="smbk-heatmap__weekday"></span>
      <span class="smbk-heatmap__weekday">Wed</span>
      <span class="smbk-heatmap__weekday"></span>
      <span class="smbk-heatmap__weekday">Fri</span>
      <span class="smbk-heatmap__weekday"></span>
      <span class="smbk-heatmap__weekday"></span>
    </div>
    <div class="smbk-heatmap__week">
      <span class="smbk-heatmap__month"></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-3"
        title="Mon, Jul 20, 2026: 11"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-4"
        title="Tue, Jul 21, 2026: 17"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-4"
        title="Wed, Jul 22, 2026: 17"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-4"
        title="Thu, Jul 23, 2026: 17"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-3"
        title="Fri, Jul 24, 2026: 14"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Sat, Jul 25, 2026: 0"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Sun, Jul 26, 2026: 0"
      ></span>
    </div>
    <div class="smbk-heatmap__week">
      <span class="smbk-heatmap__month"><span class="smbk-heatmap__month-name smbk-heatmap__month-name--wide">Aug</span></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-2"
        title="Mon, Jul 27, 2026: 7"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-4"
        title="Tue, Jul 28, 2026: 18"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-4"
        title="Wed, Jul 29, 2026: 17"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-3"
        title="Thu, Jul 30, 2026: 11"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-2"
        title="Fri, Jul 31, 2026: 10"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Sat, Aug 1, 2026: 0"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Sun, Aug 2, 2026: 0"
      ></span>
    </div>
    <div class="smbk-heatmap__week">
      <span class="smbk-heatmap__month"></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-3"
        title="Mon, Aug 3, 2026: 12"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-3"
        title="Tue, Aug 4, 2026: 14"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-3"
        title="Wed, Aug 5, 2026: 11"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-2"
        title="Thu, Aug 6, 2026: 10"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-3"
        title="Fri, Aug 7, 2026: 14"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-2"
        title="Sat, Aug 8, 2026: 6"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Sun, Aug 9, 2026: 0"
      ></span>
    </div>
    <div class="smbk-heatmap__week">
      <span class="smbk-heatmap__month"></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-4"
        title="Mon, Aug 10, 2026: 16"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-3"
        title="Tue, Aug 11, 2026: 14"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-2"
        title="Wed, Aug 12, 2026: 8"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-3"
        title="Thu, Aug 13, 2026: 11"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-4"
        title="Fri, Aug 14, 2026: 18"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Sat, Aug 15, 2026: 0"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Sun, Aug 16, 2026: 0"
      ></span>
    </div>
    <div class="smbk-heatmap__week">
      <span class="smbk-heatmap__month"></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Mon, Aug 17, 2026: 0"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-4"
        title="Tue, Aug 18, 2026: 16"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-2"
        title="Wed, Aug 19, 2026: 10"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-2"
        title="Thu, Aug 20, 2026: 7"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-4"
        title="Fri, Aug 21, 2026: 19"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-2"
        title="Sat, Aug 22, 2026: 6"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-1"
        title="Sun, Aug 23, 2026: 4"
      ></span>
    </div>
    <div class="smbk-heatmap__week">
      <span class="smbk-heatmap__month"></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-2"
        title="Mon, Aug 24, 2026: 10"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-3"
        title="Tue, Aug 25, 2026: 11"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-4"
        title="Wed, Aug 26, 2026: 17"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-4"
        title="Thu, Aug 27, 2026: 16"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-3"
        title="Fri, Aug 28, 2026: 14"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Sat, Aug 29, 2026: 0"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-1"
        title="Sun, Aug 30, 2026: 5"
      ></span>
    </div>
    <div class="smbk-heatmap__week">
      <span class="smbk-heatmap__month"><span class="smbk-heatmap__month-name smbk-heatmap__month-name--wide">Sep</span></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Mon, Aug 31, 2026: 0"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-3"
        title="Tue, Sep 1, 2026: 12"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-3"
        title="Wed, Sep 2, 2026: 14"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-4"
        title="Thu, Sep 3, 2026: 19"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Fri, Sep 4, 2026: 0"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Sat, Sep 5, 2026: 0"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Sun, Sep 6, 2026: 0"
      ></span>
    </div>
    <div class="smbk-heatmap__week">
      <span class="smbk-heatmap__month"></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-3"
        title="Mon, Sep 7, 2026: 11"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-4"
        title="Tue, Sep 8, 2026: 18"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-4"
        title="Wed, Sep 9, 2026: 19"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-3"
        title="Thu, Sep 10, 2026: 13"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-3"
        title="Fri, Sep 11, 2026: 15"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-1"
        title="Sat, Sep 12, 2026: 4"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-2"
        title="Sun, Sep 13, 2026: 7"
      ></span>
    </div>
    <div class="smbk-heatmap__week">
      <span class="smbk-heatmap__month"></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-2"
        title="Mon, Sep 14, 2026: 6"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Tue, Sep 15, 2026: 0"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-2"
        title="Wed, Sep 16, 2026: 7"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Thu, Sep 17, 2026: 0"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-2"
        title="Fri, Sep 18, 2026: 10"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Sat, Sep 19, 2026: 0"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Sun, Sep 20, 2026: 0"
      ></span>
    </div>
    <div class="smbk-heatmap__week">
      <span class="smbk-heatmap__month"></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-4"
        title="Mon, Sep 21, 2026: 16"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Tue, Sep 22, 2026: 0"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-4"
        title="Wed, Sep 23, 2026: 20"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Thu, Sep 24, 2026: 0"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Fri, Sep 25, 2026: 0"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Sat, Sep 26, 2026: 0"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-2"
        title="Sun, Sep 27, 2026: 6"
      ></span>
    </div>
    <div class="smbk-heatmap__week">
      <span class="smbk-heatmap__month"><span class="smbk-heatmap__month-name smbk-heatmap__month-name--wide">Oct</span></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-3"
        title="Mon, Sep 28, 2026: 13"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Tue, Sep 29, 2026: 0"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-3"
        title="Wed, Sep 30, 2026: 12"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-2"
        title="Thu, Oct 1, 2026: 8"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-2"
        title="Fri, Oct 2, 2026: 10"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Sat, Oct 3, 2026: 0"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-1"
        title="Sun, Oct 4, 2026: 3"
      ></span>
    </div>
    <div class="smbk-heatmap__week">
      <span class="smbk-heatmap__month"></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-4"
        title="Mon, Oct 5, 2026: 16"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-2"
        title="Tue, Oct 6, 2026: 10"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-3"
        title="Wed, Oct 7, 2026: 15"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-2"
        title="Thu, Oct 8, 2026: 7"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Fri, Oct 9, 2026: 0"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-2"
        title="Sat, Oct 10, 2026: 6"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Sun, Oct 11, 2026: 0"
      ></span>
    </div>
    <div class="smbk-heatmap__week">
      <span class="smbk-heatmap__month"></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-2"
        title="Mon, Oct 12, 2026: 7"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-3"
        title="Tue, Oct 13, 2026: 12"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-2"
        title="Wed, Oct 14, 2026: 8"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-2"
        title="Thu, Oct 15, 2026: 8"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-2"
        title="Fri, Oct 16, 2026: 9"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-1"
        title="Sat, Oct 17, 2026: 3"
      ></span>
      <span
        class="smbk-heatmap__cell smbk-heatmap__cell--level-0"
        title="Sun, Oct 18, 2026: 0"
      ></span>
    </div>
  </div>
  <div class="smbk-heatmap__legend">
    <p class="smbk-heatmap__summary">65 days with work</p>
    <div class="smbk-heatmap__scale" aria-hidden="true">
      <span class="smbk-heatmap__scale-word">Less</span>
      <span class="smbk-heatmap__cell smbk-heatmap__cell--level-0"></span>
      <span class="smbk-heatmap__cell smbk-heatmap__cell--level-1"></span>
      <span class="smbk-heatmap__cell smbk-heatmap__cell--level-2"></span>
      <span class="smbk-heatmap__cell smbk-heatmap__cell--level-3"></span>
      <span class="smbk-heatmap__cell smbk-heatmap__cell--level-4"></span>
      <span class="smbk-heatmap__scale-word">More</span>
    </div>
  </div>
  <table class="smbk-heatmap__table"><caption>Changes per day, Jul 20 to Oct 18</caption><thead><tr><th scope="col">Week of</th><th scope="col">Monday</th><th scope="col">Tuesday</th><th scope="col">Wednesday</th><th scope="col">Thursday</th><th scope="col">Friday</th><th scope="col">Saturday</th><th scope="col">Sunday</th></tr></thead><tbody><tr><th scope="row">Jul 20</th><td>11</td><td>17</td><td>17</td><td>17</td><td>14</td><td>0</td><td>0</td></tr><tr><th scope="row">Jul 27</th><td>7</td><td>18</td><td>17</td><td>11</td><td>10</td><td>0</td><td>0</td></tr><tr><th scope="row">Aug 3</th><td>12</td><td>14</td><td>11</td><td>10</td><td>14</td><td>6</td><td>0</td></tr><tr><th scope="row">Aug 10</th><td>16</td><td>14</td><td>8</td><td>11</td><td>18</td><td>0</td><td>0</td></tr><tr><th scope="row">Aug 17</th><td>0</td><td>16</td><td>10</td><td>7</td><td>19</td><td>6</td><td>4</td></tr><tr><th scope="row">Aug 24</th><td>10</td><td>11</td><td>17</td><td>16</td><td>14</td><td>0</td><td>5</td></tr><tr><th scope="row">Aug 31</th><td>0</td><td>12</td><td>14</td><td>19</td><td>0</td><td>0</td><td>0</td></tr><tr><th scope="row">Sep 7</th><td>11</td><td>18</td><td>19</td><td>13</td><td>15</td><td>4</td><td>7</td></tr><tr><th scope="row">Sep 14</th><td>6</td><td>0</td><td>7</td><td>0</td><td>10</td><td>0</td><td>0</td></tr><tr><th scope="row">Sep 21</th><td>16</td><td>0</td><td>20</td><td>0</td><td>0</td><td>0</td><td>6</td></tr><tr><th scope="row">Sep 28</th><td>13</td><td>0</td><td>12</td><td>8</td><td>10</td><td>0</td><td>3</td></tr><tr><th scope="row">Oct 5</th><td>16</td><td>10</td><td>15</td><td>7</td><td>0</td><td>6</td><td>0</td></tr><tr><th scope="row">Oct 12</th><td>7</td><td>12</td><td>8</td><td>8</td><td>9</td><td>3</td><td>0</td></tr></tbody></table>
</div>
```

## React

```tsx
import { Heatmap } from './design-system/components/heatmap/heatmap.js';

<Heatmap start="2026-07-20" values={[11, 17, 17, 17, 14, 0, 0, 7, 18, 17, 11, 10, 0, 0, 12, 14, 11, 10, 14, 6, 0, 16, 14, 8, 11, 18, 0, 0, 0, 16, 10, 7, 19, 6, 4, 10, 11, 17, 16, 14, 0, 5, 0, 12, 14, 19, 0, 0, 0, 11, 18, 19, 13, 15, 4, 7, 6, 0, 7, 0, 10, 0, 0, 16, 0, 20, 0, 0, 0, 6, 13, 0, 12, 8, 10, 0, 3, 16, 10, 15, 7, 0, 6, 0, 7, 12, 8, 8, 9, 3, 0]} label="Changes per day, Jul 20 to Oct 18" summary="65 days with work" legend />
```

## Stylesheet

```css
/* smbk-heatmap — Heatmap. Figma "Heatmap" 7580:375.
 * A column for each week, Monday at the top, each day a small square in its level's shade: the track's faint
 * gray for none, then four steps of the sequential data color from less to more. Monday, Wednesday and Friday
 * are named at the left and each month above the week it starts in. Under the grid, the summary at the left and
 * the scale from less to more at the right. Days outside the data are left empty. The picture is hidden from
 * screen readers, which read the same values in a table kept out of sight. In a narrow layout the heatmap shows
 * its last 13 weeks; the table keeps them all. */

.smbk-heatmap {
  display: flex;
  flex-direction: column;
  gap: var(--smbk-space-stack-sm);
  width: max-content;
  max-width: 100%;
  color: var(--smbk-color-text-subtle);
  font-family: var(--smbk-typography-body-xs-font-family);
  font-size: var(--smbk-typography-body-xs-font-size);
  font-weight: var(--smbk-typography-body-xs-font-weight);
  line-height: var(--smbk-typography-body-xs-line-height);
  letter-spacing: var(--smbk-typography-body-xs-letter-spacing);
  text-transform: var(--smbk-typography-body-xs-text-transform);
}

/* The block frames the words it hides for screen readers, so they stay inside it wherever it is placed: without a
   frame they hang from the page itself and stretch it, past the end of an area that scrolls. No weight, so a parent
   that places the block keeps its say. */
:where(.smbk-heatmap) {
  position: relative;
}

.smbk-heatmap__chart {
  display: flex;
  gap: var(--smbk-space-4);
}

.smbk-heatmap__weekdays,
.smbk-heatmap__week {
  display: flex;
  flex: none;
  flex-direction: column;
  gap: var(--smbk-space-4);
}

.smbk-heatmap__weekdays {
  width: var(--smbk-size-28);
}

/* The month row: as tall as a line of text, a step further from the grid than the days are from each other.
   A name starts over its week and runs on over the next weeks, whose month slots are empty. */
.smbk-heatmap__month {
  display: block;
  width: var(--smbk-size-12);
  height: calc(var(--smbk-typography-body-xs-font-size) * var(--smbk-typography-body-xs-line-height));
  margin-bottom: calc(var(--smbk-space-stack-sm) - var(--smbk-space-4));
  white-space: nowrap;
}

.smbk-heatmap__weekdays .smbk-heatmap__month {
  width: auto;
}

.smbk-heatmap__month-name--narrow {
  display: none;
}

/* A weekday's name is centred on its row of squares, whose height it does not change. */
.smbk-heatmap__weekday {
  display: flex;
  align-items: center;
  height: var(--smbk-size-12);
  white-space: nowrap;
}

.smbk-heatmap__cell {
  display: block;
  flex: none;
  width: var(--smbk-size-12);
  height: var(--smbk-size-12);
  border-radius: var(--smbk-radius-2);
  background: var(--smbk-color-surface-track-subtle);
}

.smbk-heatmap__cell--level-1 { background: var(--smbk-color-data-sequential-2); }
.smbk-heatmap__cell--level-2 { background: var(--smbk-color-data-sequential-3); }
.smbk-heatmap__cell--level-3 { background: var(--smbk-color-data-sequential-4); }
.smbk-heatmap__cell--level-4 { background: var(--smbk-color-data-sequential-5); }

.smbk-heatmap__cell--blank {
  background: none;
}

.smbk-heatmap__legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--smbk-space-stack-xs) var(--smbk-space-inline-lg);
}

.smbk-heatmap__summary {
  margin: 0;
}

.smbk-heatmap__scale {
  display: flex;
  align-items: center;
  gap: var(--smbk-space-4);
}

/* The table and a summary without its legend, for screen readers only. */
/* .smbk-heatmap__table and .smbk-heatmap__hidden: hidden from view, kept for screen readers and the keyboard, by the shared rule in visually-hidden/visually-hidden.css. */

/* A table takes the room its rows need whatever width and height it is given, so the hidden one is full size, only
   unseen. It hangs from the block's end corner, reaching back and up, the way a page never scrolls: it adds no room
   to the block or to any area that scrolls around it, and stays a table for screen readers. */
.smbk-heatmap__table {
  inset-block-end: 0;
  inset-inline-end: 0;
}

/* A narrow space shows the last 13 weeks, with the months named as if they began there. */
@container style(--smbk-layout: narrow) {
  .smbk-heatmap__week--early,
  .smbk-heatmap__month-name--wide {
    display: none;
  }

  .smbk-heatmap__month-name--narrow {
    display: inline;
  }
}

/* ---- high contrast (forced colors) ---- */
/* The squares keep their shades, so the scale still reads from less to more; the table holds every value. */

@media (forced-colors: active) {
  .smbk-heatmap__cell {
    forced-color-adjust: none;
  }
}
```

## Tokens it reads

```json
{
  "space": {
    "4": {
      "$type": "dimension",
      "$value": "4px",
      "$description": "Raw space step, 4 px. Only for fixed distances inside a component; spacing that follows density uses space/inset, stack or inline."
    },
    "stack": {
      "sm": {
        "$type": "dimension",
        "$value": "{{space.8}}",
        "$description": "Gap between things stacked one above another, small."
      },
      "xs": {
        "$type": "dimension",
        "$value": "{{space.4}}",
        "$description": "Gap between things stacked one above another, extra small."
      }
    },
    "inline": {
      "lg": {
        "$type": "dimension",
        "$value": "{{space.12}}",
        "$description": "Gap between things side by side, large."
      }
    }
  },
  "color": {
    "text": {
      "subtle": {
        "$type": "color",
        "$value": "{{color.grey.700}}",
        "$description": "Secondary text: descriptions, metadata."
      }
    },
    "surface": {
      "track-subtle": {
        "$type": "color",
        "$value": "{{color.grey.300}}",
        "$description": "The empty part of a progress track: light enough that the fill stands out by lightness, not only by hue."
      }
    },
    "data": {
      "sequential": {
        "2": {
          "$type": "color",
          "$value": "{{palette.light.sequential.2}}",
          "$description": "Light blue/400, dark blue/700. Marks reach 3:1 on the plot background; never colour alone: direct labels, markers or patterns too."
        },
        "3": {
          "$type": "color",
          "$value": "{{palette.light.sequential.3}}",
          "$description": "Sequential scale, step 3. Light blue/500, dark blue/600. Marks reach 3:1 on the plot background; never colour alone: direct labels, markers or patterns too."
        },
        "4": {
          "$type": "color",
          "$value": "{{palette.light.sequential.4}}",
          "$description": "Sequential scale, step 4. Light blue/600, dark blue/500. Marks reach 3:1 on the plot background; never colour alone: direct labels, markers or patterns too."
        },
        "5": {
          "$type": "color",
          "$value": "{{palette.light.sequential.5}}",
          "$description": "Sequential scale, high end: stands out most in both themes. Light blue/700, dark blue/300. Marks reach 3:1 on the plot background; never colour alone: direct labels, markers or patterns too."
        }
      }
    }
  },
  "typography": {
    "body-xs": {
      "$type": "typography",
      "$value": {
        "fontFamily": "Geist, Geist Fallback, system-ui, sans-serif",
        "fontSize": "12px",
        "fontWeight": 400,
        "lineHeight": 1.5,
        "letterSpacing": "0px"
      }
    }
  },
  "size": {
    "12": {
      "$type": "dimension",
      "$value": "12px",
      "$description": "Raw size step, 12 px. Only for fixed sizes inside a component; semantic sizes (size/control, icon, mark) point here."
    },
    "28": {
      "$type": "dimension",
      "$value": "28px",
      "$description": "Raw size step, 28 px. Only for fixed sizes inside a component; semantic sizes (size/control, icon, mark) point here."
    }
  },
  "radius": {
    "2": {
      "$type": "dimension",
      "$value": "2px",
      "$description": "Raw corner step, 2 px. Semantic corners (radius/control, container) point here."
    }
  }
}
```

## Purpose

Shows how much happened on each day over a quarter or a half year, a square for each day shaded from less to more, so a reader sees busy weeks, quiet ones and the rhythm of the week at a glance. It differs from a bar chart, which compares totals a reader can read off.

## Anatomy

- The block, as wide as its weeks.
- The chart part: the weekdays part at the left, naming Monday, Wednesday and Friday in weekday parts, then a week part for each week, Monday at the top. Each week holds a month part, naming the month above the week it starts in, and a cell part for each day. A cell's level is a modifier of the part: level 0 for nothing, then levels 1 to 4 in the sequential data colors from light to strong; a blank cell is a day outside the data.
- The legend part: the summary part at the left, such as "141 days with work", and the scale part at the right, the words less and more around one square of each level.
- The table part: the same values, a week to a row, for screen readers only.

## When to use

- How much a person or a team worked, published or changed, day by day, over 13 or 26 weeks.
- A pattern across the days of the week, such as quiet weekends.

## When not to use

- When the reader needs exact amounts. Use a [bar chart](bar-chart.md) or a [table](table.md).
- For values that can be below zero or that go both ways. Use a chart with a diverging scale.
- For fewer than about eight weeks. A short table or a bar chart says it better.

## Behavior

The wrapper shades each day by a quarter of the highest value per level, or of a highest value the page gives, so several heatmaps can share one scale. A week runs Monday to Sunday; days before the first value and after the last are left empty. In a narrow layout the heatmap shows its last 13 weeks, naming the months as if they began there; the table keeps every week. The wrapper writes the month and weekday names and the table's values in English unless `locale` names another language (or `format` writes the values), so a page prepared on a server shows the same words once its script runs. Pointing at a day shows the browser's own tooltip, with its date and value; hand-written markup puts the same words in a `title` on the day. Nothing moves and nothing takes focus.

## Accessibility

### What it does for you

- The picture is hidden from screen readers. They read a table instead, titled by the heatmap's label, with a row for each week and a column for each day, holding each day's value.
- The summary is in words under the grid and read in its place.
- The shades are never the only way to read a value: the table holds them all. The lightest shades are faint against the page, which is why the table is always there.
- In high contrast mode the squares keep their shades, so the scale still reads from less to more.
- Nothing in it takes focus.

### What you must do

- Give a label: it titles the table a screen reader reads.
- Give the summary the fact that matters, such as how many days had work.
- In markup written by hand, keep the table and hide the chart part and the scale part.

### How to test

- With a screen reader, the picture is skipped, the table is read by its label with each week and day's value, and the summary is read in words.
- With the colors removed, the table and the summary still hold every value.
- In a forced-color mode, the squares keep their shades and the scale reads from less to more.
- With text at 200% and the page 320 pixels wide, the heatmap shows its last 13 weeks and the legend stays whole.

## Usage rules

### Do

- Say what the values are in the label and the title, with their unit.
- Give a summary that answers the reader's first question.
- Give heatmaps side by side one highest value, so their shades compare.

### Don't

- Use the heatmap's shades for anything but more and less.
- Leave out the label: it titles the table a screen reader reads.
