> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Text

> The text block puts notes or a headline sentence between the charts, with metric values that come from the same queries and formats as the KPIs on the page.

A text block puts a few sentences between the charts: the finding of the page, or notes on what
moved. The numbers in it come from the same queries as the rest of the page, so the prose and the
charts never disagree.

```yaml theme={null}
type: text
title: What moved in October
span: 4
markdown: |
  - Revenue was **{{revenue}}**, {{revenue.change_pct}} against {{revenue.previous}}.
  - The refund rate moved {{refund_rate.change}} to {{refund_rate}}.
  - Definitions are in the [metrics guide](https://example.com/metrics).
```

[Live preview of the text component](https://hatchmark-preview.hatchmark.workers.dev/components/?embed=text\&theme=light)

The preview above is the live component gallery. [Open it full size](https://hatchmark-preview.hatchmark.workers.dev/#section=text) to switch between desktop and phone widths.

| Field | Meaning |
| - | - |
| `type` | `"text"`. |
| `markdown` | The words, in the Markdown subset below, with `{{metric}}` references. |
| `style` | `note` (default): body text, for notes beside the charts. `lede`: one large headline sentence that opens the page. |

Blocks also take the usual `id`, `title` and `span`. A text block has no `height`: it is as tall
as its words, and check warns when that would stretch its row (HM5051).

You choose the words; Hatchmark chooses the form. There are no font, colour, size or alignment
options: a note uses the theme's body text (13/18 px) and a lede its page-title size (20/28 px), so
every text card on every page looks the same.

## Markdown

* **Paragraphs**, separated by a blank line. Lines in one paragraph join with a space.
* **Lists**: `-`, `*` or `+` for bullets, `1.` or `1)` for numbers. A numbered list keeps its first
  number. A line that follows an item without a blank line continues that item.
* **Bold** with `**two asterisks**`.
* **Links** with `[text](url)`. A link opens an `http`, `https` or `mailto` address, or a path on
  the same site; any other target, such as `javascript:`, keeps only its text.
* A backslash makes the next character literal: `\#`, `\<`, `\*`, `\{\{`.

Headings, images, tables and raw HTML are errors (HM3020): the card's heading is `title`, numbers
by category belong in a table block, and HTML would not follow the theme. Anything else, such as
`_italic_`, prints as written.

## References

| Reference | Shows |
| - | - |
| `{{metric}}` | The metric over the dashboard period, as the KPI of that metric shows it (`$1.84M`). |
| `{{metric.previous}}` | The metric over the comparison period (`$1.68M`). |
| `{{metric.change}}` | The difference, with its sign (`+$164K`). For a percent metric, in percentage points. |
| `{{metric.change_pct}}` | The relative change (`+9.8%`). For a percent metric, the change in points (`+0.26 pp`). |

* **The same numbers as a KPI.** Each reference reads the metric over the page's period, with its
  filters and segments, through the same planner as a `kpi` block, and is formatted with the
  metric's own `format` at the KPI's headline precision. A KPI and a reference to the same metric
  print the same value. They print the same previous value and change when the KPI uses the page's
  comparison; a KPI with its own `compare` shows that comparison instead.
* **The comparison** is the dashboard's `period.compare`. A comparison reference with `compare: none`
  is an error (HM2011), and so is one on a metric with no time column (HM2005).
* **No value** prints a dash: no data in the period, no previous value, or a previous value of zero
  for `change_pct`. On a custom date range, a metric that cannot be added up from days (a distinct
  count, a median) prints a dash too, and the card says to pick a preset.
* An unknown metric (HM2003) or field (HM2007) is an error.

## Fitting the page

Text sits among charts, so check keeps it in proportion. The numbers come from the theme's type
scale and a 1280 px wide page.

* **Length** (HM5050, warning). A lede is one paragraph of one or two sentences and at most 140
  characters, one line at full width. A note holds about five list items: at most 7 paragraphs or
  list items and 600 characters, which fills a default-height row beside a chart. A reference counts
  as 5 characters.
* **Height** (HM5051, warning). Cards in a row share one height. When a text card, title included,
  would be more than 8 px taller than every other card in its row at a 1280 px page, Hatchmark says
  by how much and how to fix it: shorten the text, widen its `span`, or move it to its own row.
  Check compares it with line, area, scatter and vertical bar charts, whose height is their preset.
  Beside a table, build compares once the table's rows are known. Rows with KPIs, horizontal bars,
  pies or maps, whose height depends on the data, are not checked.
* **Width** (HM5052, warning). A text block takes at least 4 of the 12 columns; a smaller `span` is
  drawn 4 wide. In wider cards a line stops at 70 characters, so long lines stay readable.
* **The lede opens the page** (HM5053, warning). A page has at most one lede, and it is the first
  block.
* **Typed numbers** (HM5054, warning). A currency amount or a percentage written into the prose
  (`$1.2M`, `12%`, `0.4 pp`) stays the same when the data or the filters change. Build also warns
  when a plain number such as `21,874` equals a value a KPI or reference on the page prints. Dates,
  years, times, list numbers and small counts are never flagged. Use a reference instead.
* **One comparison** (HM5055, warning). References compare with the page's `period.compare`. When a
  KPI of the same metric sets its own `compare`, the page would state two changes for one metric.

## What it draws

* A card with the title, when there is one, and the prose. A lede draws at the page-title size.
* References never break across lines. Bold is semibold; links are underlined in the text colour.
* Phones get the same card at full width.

## Checks

| Code | When | Fix |
| - | - | - |
| `HM3020` | Error. A heading, image, table or raw HTML. | Put a heading in `title`, numbers in a table block; escape a literal `<` as `\<`. |
| `HM2003` | Error. A reference names no metric. | Use a metric name from `metrics/`. |
| `HM2007` | Error. A reference is malformed, names an unknown field, or does not close on its line. | Write `{{metric}}` or `{{metric.previous}}`, `.change`, `.change_pct`. |
| `HM2011` | Error. A comparison reference on a dashboard with `compare: none`. | Set `period.compare`, or use `{{metric}}` alone. |
| `HM2005` | Error. A comparison reference on a metric with no time column. | Use `{{metric}}` alone. |
| `HM5050` | Warning. A lede over 2 sentences or 140 characters; a note over 7 parts or 600 characters. | Keep one finding in the lede; split a long note in two. |
| `HM5051` | Warning. The text card is taller than every other card in its row. | Shorten it, widen `span`, or give it its own row. |
| `HM5052` | Warning. `span` is below 4. | Set `span: 4` (the fix, safe). |
| `HM5053` | Warning. A lede that is not the first block, or a second lede. | Move it to the top, or set `style: note` (the fix, unsafe). |
| `HM5054` | Warning. A number typed into the prose. | Use `{{metric}}`, `.previous`, `.change` or `.change_pct`. |
| `HM5055` | Warning. A comparison reference to a metric whose KPI sets its own `compare`. | Drop `compare` from the KPI, or say in the text which comparison it uses. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.