# Numbers

## stat

[See examples](https://legatobar.com/features#card-stat)

A single headline number.

| Field | | |
| --- | --- | --- |
| `label` | required | What the number is. |
| `value` | required | A number, or a string of up to 32 characters (`"99.98%"`, `"3 of 5"`). |
| `unit` | optional | A currency code, or a unit shown after the value (`Mbps`). |
| `delta` | optional | The change: a number (shown with a sign and an up or down arrow, and as money when `unit` is a currency), or a string of up to 16 characters (`"14 days to go"`). |
| `url` | optional | Where a click on the card goes: [another page](https://legatobar.com/docs/card-fields.md#links-to-other-pages) with more, or an https address. See [Cards that link](https://legatobar.com/docs/card-fields.md#cards-that-link). |

```json
{ "id": "balance", "type": "stat", "label": "Checking", "value": 4218.55, "unit": "USD", "delta": 312.4 }
```

## pacing

[See examples](https://legatobar.com/features#card-pacing)

Progress against a target: a budget over the month, a sprint, steps toward today's goal. Or rows, each against its own target: a budget per category.

| Field | | |
| --- | --- | --- |
| `label` | required | |
| `value` | required, unless there are `items` | Where you are now, a number. |
| `target` | required, unless there are `items` | The goal, a number above 0. |
| `elapsed` | optional | The fraction of the period gone, from 0 to 1. Halfway through the month is `0.5`. Leave it out for a goal with no period, like steps today. On a page without a [period](https://legatobar.com/docs/periods.md), `{ "month_elapsed": true }` in the map gives how far through this month today is. |
| `unit` | optional | |
| `detail` | optional | A second line under the card, up to 120 characters: `"no mindful minutes yet"`. |
| `shape` | optional | `bar` (the default), `ring`, or `rings` with 1 to 3 `items`: see [Rings](https://legatobar.com/docs/card-numbers.md#rings). |
| `amounts` | optional | `left` for a budget's words: each bar row says what's left (`$288 left`) or how far over (`$36 over`), and the pace line says `$521 under pace` or `over pace`. The card's own total keeps `$5,161 of $7,103`. Rings keep their figures. `value` draws the card's value as one large figure under its name (`65%`), with `note` beside it, for a level whose target is its full scale, such as a battery out of 100%. Default `spent`. |
| `note` | optional | With `amounts: value`, a few words beside the large figure, such as a battery's range (`213 mi`). |
| `color` | optional | The bar's colour, by a [breakdown](https://legatobar.com/docs/card-numbers.md#breakdown)'s names, where the colour means something: a battery's charge in `green`. Without it, the theme's chart colour. |
| `hide_caption` | optional | `true` leaves out the pace line under the bar or ring, which shows only with `elapsed`, like "$380 ahead of pace". Default `false`. |
| `items` | optional | Up to 20 rows of `{ "label", "value", "target", "icon", "key", "unit" }`: a label of 1–40 characters, a number, a target above 0, and optionally an [item icon](https://legatobar.com/docs/card-fields.md#item-icons), a `key` for its `details`, and a `unit` of its own when it isn't the card's. A row can also have a `subtitle`, `state`, `detail`, `url` and `image`: see [Rows with more](https://legatobar.com/docs/card-numbers.md#rows-with-more). |
| `image_shape` | optional | `poster` (the default), `square` or `wide`: the rows' [thumbnails](https://legatobar.com/docs/card-numbers.md#images-on-rows), unless a row sets its own. |
| `details` | optional | Up to 500 lines of `{ "key", "text", "detail", "url" }` that rows show when clicked open: the key of their row, a text of 1–80 characters, and optionally a right-aligned detail of up to 40, its `detail_color` (a refund in `green`, by the [breakdown card's names](https://legatobar.com/docs/card-numbers.md#breakdown)), an `aside` of up to 24 in a grey column (a date; `details_aside_at` puts it at the `start` or `end`, and once a line has one, dates and amounts each keep one width) and an https or `legato://page/ID` link to the individual record. |
| `fit` | optional | Keeps the page within the sidebar's length. The card shows as many rows as fit, at least 5, with **Show *N* more** only when some are left out. An opened row shows as many of its lines as fit, at least 3, with **Show all** only when some are left out, and the row opened last gives way first. Without the sidebar, every row shows and an opened row shows 20 lines. |
| `url` | optional | Where a click on the card goes: [another page](https://legatobar.com/docs/card-fields.md#links-to-other-pages) with more, such as an exercise ring leading to past days and workouts, or an https address. A card with `items` isn't a link, since a click on a row opens its details, unless its shape is `rings`. See [Cards that link](https://legatobar.com/docs/card-fields.md#cards-that-link). |

A bar takes the full width: "$2,140 of $3,200" and a bar filled to `value / target`. With `elapsed`, a tick marks where you'd be if exactly on pace, and a line under the bar says the pace: "$380 ahead of pace", "6 min behind pace", or "On pace" within 3% of the target. Nothing is coloured for being ahead or over: the tick, a full bar and the figures say it. Pacing never changes the page's status dot either, since ahead is bad for a budget and good for a sprint. Without `elapsed` there's no tick and no line: the figures and the bar already say how far there is to go.

With `items`, each row is the label, "$412 of $600" (the amount in the row's colour, "of $600" in grey) and its own bar. With `elapsed` every row has the pace tick. Leave `value` and `target` out to show only the rows, or set them for an overall bar above them. A card with rows is drawn as bars, whatever its `shape`.

Sourced rows can carry up to three places for buttons at their end, such as Message and Stop on a stream: see [Buttons on each row](https://legatobar.com/docs/button-rows.md#buttons-on-each-row).

A row with a `key` that `details` lines share gets a disclosure chevron: clicking it shows that row's first 20 lines under it, in the order given, with **Show all** for the remaining supplied lines and **Show fewer** to return to the preview. Clicking the row again hides its lines. A detail line with `url` opens its record separately from the row disclosure. This only reveals lines the page supplied; it does not fetch further records. Keys can be text or numbers, and `12` matches `"12"`, so a source can map a category's id straight in. A line without a key, such as an uncategorized transaction's, is skipped, and the rest of the card still shows. On a budget, that's each category's transactions this month:

```json
"details": [ { "key": 3411218, "text": "Costco", "detail": "$212 · Oct 14" }, { "key": 3411218, "text": "Trader Joe's", "detail": "$86 · Oct 21" } ]
```

```json
{ "id": "budgets", "type": "pacing", "label": "Budgets this month", "unit": "USD",
  "items": [ { "label": "Groceries", "value": 412, "target": 600 }, { "label": "Restaurants", "value": 260, "target": 200 } ] }
```

### Rows with more

A row can say more than its label and figures, as a stream does while it plays: what's on, who's watching, where. Each part is optional.

| Field | | |
| --- | --- | --- |
| `subtitle` | optional | Up to 80 characters, in grey after the label on the title line: `"S2 · E5 · The Long Tide"`. When the line runs short, the subtitle is cut first, then the label. |
| `state` | optional | Up to 16 characters, a grey word at the right of the title line: `"Paused"`. It's words only: it never colours the row or counts as a problem. |
| `detail` | optional | Up to 80 characters, a grey line under the bar: `"riley · Living room TV · Direct play"`. Once any row has one, every row draws the line, and its figure ("31 of 47 min") moves to the line's end, so the rows keep one height. |
| `url` | optional | Makes the row a link, as a [list](https://legatobar.com/docs/card-lists.md#list) row is: https, [another page](https://legatobar.com/docs/card-fields.md#links-to-other-pages), or plain http on the card's source's own address, so a server on your network links. A row with `details` lines opens them instead, and Preview Source says its `url` isn't used. |
| `image` | optional | A thumbnail before the row, as tall as its words. See [Images on rows](https://legatobar.com/docs/card-numbers.md#images-on-rows). |
| `image_shape` | optional | The row's own shape, overriding the card's. |

Rows without these parts draw exactly as before. A row's text is cut by the line, never in the data: VoiceOver reads all of it. With a source, map the rows with `each`, and give `source.empty` for an answer with none:

```json
{ "id": "now", "type": "pacing", "label": "Now playing", "unit": "min", "items": [],
  "source": { "ref": "media", "empty": { "when": { "path": "streams[0]", "exists": false }, "text": "Nothing playing" },
    "map": { "items": { "each": "streams", "fields": { "key": "id", "label": "title", "subtitle": "episode", "state": "state",
      "detail": "where", "value": "minutes", "target": "length", "image": { "template": "/Items/{item_id|raw}/Images/Primary?fillHeight=96" } } } } } }
```

### Images on rows

`pacing` rows and `list` items take an `image`: a poster, an album's cover or a still, drawn in the icon's place. They keep their own colours: they're media, the one exception to [logos in one colour](https://legatobar.com/docs/card-fields.md#item-icons).

- **From the card's source only.** `image` is a path on the source's own address (`/Items/9f…/Images/Primary`), or a full http(s) address on that same scheme, host and port. Anything else is refused: the row draws its placeholder, and Preview Source says why. A card whose source isn't read over http can't have images, and its page doesn't load.
- **Signed in as the source is.** Each image is fetched with the source's own sign-in, through the same connection settings, only while the panel shows the card, at most four at once and 2 MB each. Only PNG, JPEG, WebP, HEIC and GIF (its first frame) are drawn.
- **Kept on this Mac.** Images are kept in Legato's cache folder, about 50 MB at most, the least recently shown going first, and used for a week before they're fetched again. A failed image never shows a note or fails the card: its row keeps the placeholder and it's tried again ten minutes later.
- **Nothing moves.** A neutral placeholder of the same size shows while an image loads or when it can't, with the row's `icon` in it, or a picture mark once an image can't be had. A row whose `image` is empty (`""`) asks for nothing and shows the placeholder: map it that way when the service says an item has no artwork (Jellyfin's image tags), so no request goes for a picture that isn't there. Once any row has an image, every row keeps the thumbnail's room, so the words line up. VoiceOver skips the thumbnails, since the row's words already say what it is.

**Settings → General → Load icons from the web** doesn't apply to these images: they come from the service the card is connected to, never from anywhere else.

| `image_shape` | Shape |
| --- | --- |
| `poster` (the default) | 2:3, a film's or a show's |
| `square` | 1:1, an album's |
| `wide` | 16:9, a still |

On a pacing row the thumbnail is as tall as the row's words; on a list row it's one line and a little. A row's own `image_shape` overrides its card's, so a song's square cover can sit among posters.

A ring is half width, like a fitness ring: filled to `value / target`, with the value beside it and the target under that. It shares its row with the next card if that one is half width too.

```json
{ "id": "month", "type": "pacing", "label": "October spend", "value": 2140, "target": 3200, "elapsed": 0.55, "unit": "USD" }
```

```json
{ "id": "steps", "type": "pacing", "shape": "ring", "label": "Steps", "value": 83, "target": 8000, "unit": "steps", "detail": "no mindful minutes yet" }
```

### Rings

With `"shape": "rings"`, 1 to 3 `items` are nested rings, the first outermost, the way a watch shows Move, Exercise and Stand. The card is half width. Beside the rings, each item's value and target ("310/500 kcal") are in its ring's colour. The items' labels aren't drawn, since the units tell the rings apart, but VoiceOver reads them. Give each item its own `unit`. A ring past its target is drawn full; rings have no pace tick or caption. Name a `color` on an item to choose its ring's colour; without one, rings take pink, green and teal in turn. Get Card Value reads the first ring.

```json
{ "id": "activity", "type": "pacing", "shape": "rings", "label": "Activity", "url": "legato://page/exercise",
  "items": [ { "label": "Move", "value": 310, "target": 500, "unit": "kcal" },
            { "label": "Exercise", "value": 12, "target": 30, "unit": "min" },
            { "label": "Stand", "value": 4, "target": 12, "unit": "h" } ] }
```

Add `days` and the card is a full-width calendar instead, with small rings for each day under the title. Each day has a `date` (`YYYY-MM-DD`) and `values`, one for each item in the items' order (`null` for a day with no figure). The items still give each ring's target, unit and colour. Days without an entry draw empty rings, and today is outlined. An empty `days` array keeps the card full width and says "No figures for this period." Each day’s readings, goals and missing figures are available to VoiceOver and on hover.

| Field | | |
| --- | --- | --- |
| `days` | optional | Up to 42 of `{ "date", "values" }`, with no more values than items. Without `calendar`, the first and last dates must fit within 42 consecutive days, which can take seven calendar rows. |
| `calendar` | optional | `week` or `month`: the week or the whole month the days are in, so a month's first few days still show the whole month. Without it, the weeks from the first day to the last. |

On a page with a [period](https://legatobar.com/docs/periods.md#periods), map `days` from a source's daily rows with `each`, using field names like `values[0]` for each item's value and `default: null` for missing readings, and set `calendar` from the period. A null default preserves the position of the next ring without turning an absent reading into zero. Show it only for a week or a month, beside a rings card for the period's average:

```json
{ "id": "each-day", "type": "pacing", "shape": "rings", "label": "Each day", "calendar": "month",
  "items": [ { "label": "Move", "value": 0, "target": 500, "unit": "kcal" },
            { "label": "Exercise", "value": 0, "target": 30, "unit": "min" },
            { "label": "Stand", "value": 0, "target": 12, "unit": "h" } ],
  "days": [ { "date": "2026-11-01", "values": [480, 35, 12] }, { "date": "2026-11-02", "values": [410, 22, 11] } ] }
```

## sparkline

[See examples](https://legatobar.com/features#card-sparkline)

A trend line.

| Field | | |
| --- | --- | --- |
| `label` | optional | Leave it out when the page's title already says what the line is, such as a Net Worth page's trend. |
| `points` | required | 2–240 numbers, oldest first. A card is about 330 points wide at full width, so more than 240 can't be told apart; average a longer series down with [`buckets`](https://legatobar.com/docs/mapping.md#mapping). |
| `max` | optional | The most the value can be, such as a machine's memory. The chart runs from zero up to it, with a dashed line there, so the fill shows how much of it is used, and the value reads "9.4 GB of 13 GB". A value over it still shows. A percentage pinned at `100` with `unit` `%`, such as a machine's CPU, keeps the 0–100% scale without the line or the "of 100%". |
| `target` | optional | A level the value is meant to reach or stay under, such as a car's charge limit. A dashed line, kept in view, and the value reads "69% · Limit 80%". Unlike `max`, the chart doesn't run from zero. |
| `target_label` | optional | The target's name, 1 to 24 characters. `Target` without one. |
| `right_unit`, `right_scale` | optional | A second scale on the right for the same line: the value times `right_scale`, in `right_unit` (1 to 8 characters). A car's battery reads in miles of range beside its percentage, with `right_scale` the miles for each percent, filled from its source. The value reads "69% · 224 mi". Give both or neither. |
| `change` | optional | `false` leaves out the badge beside the value that says how far it is from the first point. On by default; turn it off for a reading whose change isn't news, such as a machine's CPU or memory. |
| `width` | optional | `full` (the default) or `half`: a small chart that shares a row with the half-width card beside it, such as a machine's CPU beside its memory. Half width, `max`'s "of 13 GB" goes under the value, only the first and last labels sit under the line, and two charts in a row end on the same line. |
| `times` | optional | When each point was, one per point and in order: Unix seconds (or milliseconds) or ISO 8601. The points then sit at their moments rather than evenly spaced, and the line breaks where readings stop for more than three times their usual spacing (and at least 15 minutes), such as a car asleep overnight. Map it from the same list as `points`, with the same `each`. |
| `axis_labels` | optional | What's drawn under the line, one per point like `labels`, when it should be shorter than what the pointer shows: "9 PM" under the chart, "8:54 PM" on hover. Without it, `labels` are drawn there too. |
| `unit` | optional | |
| `start_label` | optional | 1–24 characters under the line's first point: the time it stands for, like `"12h ago"` or `"Oct 1"`. |
| `end_label` | optional | 1–24 characters under the last point: `"Now"`, `"Today"` or a date. |
| `labels` | optional | What each point stands for, one per point, oldest first, each 1–24 characters: `["Jan", "Feb", …]` or dates. |
| `shape` | optional | `smooth` (the default) joins the points with a curve; `sharp` joins them with straight segments, for values that shouldn't read as passing through the ones in between. |
| `grid` | optional | `true` draws lines across the chart at the axis's values. Off by default; the values down the leading edge show either way. |
| `series`, `points2` | optional | A second line on the same scale: two internet connections' latency, or download beside upload. `series` names the two lines (1 to 16 characters each) and `points2` holds the second's readings. Give both or neither. See [Two lines](#two-lines). |
| `times2` | optional | With `times` and `points2`: when each of `points2`'s readings was, as `times` is for `points`. |

A label that's empty, `null` or longer than 24 characters makes the card unreadable, from a page file or a source alike, and so do `labels` that don't have one for each point.

The card shows its label, then the latest value with its change since the first point. The change is a percentage, or the difference itself when a percentage would mislead: a unit of `%` or degrees, a first point of zero, or a change of sign. It's never coloured, since up isn't always good.

Under that is the line over a fading fill, its last point marked, with the values on an axis down its leading edge. With `labels`, up to five of them sit under the line: the first, the last and some evenly between. Without them, `start_label` and `end_label` sit under the ends. Rest the pointer on the line and the point under it is marked: the value, its change and its label show in the card's header until the pointer leaves.

When a service only reports a value as it is now, a sourced sparkline can draw its trend from readings the Mac records itself: see [Sparkline readings](https://legatobar.com/docs/mapping-sparklines.md#sparkline-readings). Such a card labels its points from its readings unless the page sets them: dates, ending with "Today", for daily readings; times, ending with "Now", for more often.

```json
{ "id": "cpu", "type": "sparkline", "label": "Host CPU", "unit": "%", "points": [12, 14, 11, 18, 22, 35, 41, 38, 27, 19],
  "start_label": "10m ago", "end_label": "Now" }
```

### Two lines

`series` and `points2` draw a second line on the same scale, in orange, without a fill. The header names each line beside a dot in its colour, with its latest reading: "● WAN 12 ms  ● WAN2 31 ms". Rest the pointer on the chart and each line shows its reading there. A line with no reading near the pointer shows "—". There's no change badge, since "since the first point" has no single answer for two lines, and no `right_unit`.

Without `times`, the two lines line up point for point, so `points2` has one reading for each of `points`. With `times`, give `points2` its own `times2`. Each line then sits at its own moments, and a reading one line doesn't have is a gap in that line, never a zero. A line breaks where its readings stop for more than one and a half times their usual spacing and twice the shortest, so a connection down for two hours of hourly readings breaks its own line there and leaves the other as it was. Readings averaged into `buckets` come one or two steps apart, and that never breaks a line. Either list can be empty while its line has no readings.

```json
{ "id": "latency", "type": "sparkline", "label": "Latency", "unit": "ms", "series": ["WAN", "WAN2"],
  "points": [9, 11, 8, 30, 9], "times": [1794900000, 1794903600, 1794907200, 1794910800, 1794914400],
  "points2": [24, 22, 26], "times2": [1794900000, 1794903600, 1794914400] }
```

From a source, map each line from its own rows with the same `each` for the points and their times:

```json
"points":  { "each": "wan1", "value": "ms", "buckets": 180 },
"times":   { "each": "wan1", "template": "{t}", "buckets": 180 },
"points2": { "each": "wan2", "value": "ms", "buckets": 180 },
"times2":  { "each": "wan2", "template": "{t}", "buckets": 180 }
```

```json
{ "id": "rate", "type": "sparkline", "label": "30-year mortgage rate", "unit": "%", "shape": "sharp",
  "points": [6.41, 6.38, 6.35, 6.37, 6.29, 6.22, 6.24, 6.18, 6.15, 6.11, 6.09, 6.12],
  "labels": ["Nov", "Dec", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct"] }
```

## gauge

[See examples](https://legatobar.com/features#card-gauge)

A value within a range, with bands that say what the value means.

| Field | | |
| --- | --- | --- |
| `label` | required | |
| `value` | required | A number. One past either end sits at that end. |
| `min` | optional | The bottom of the range, `0` if left out. |
| `max` | required | The top of the range, above `min`. |
| `unit` | optional | |
| `bands` | optional | 1 to 6 of `{ "from", "to", "state" }`, in order. `from` defaults to `min` and `to` to `max`, and each `to` must be above its `from`. `state` is `ok`, `warning` or `critical`. |

Half width. The number, a track from `min` to `max` with each band in its colour and a dot where the value sits, and the range underneath. The band the value is in colours the number, names its state when it isn't `ok` (at full width), and counts toward the page's status and notifications exactly as a `status` would. Leave bands out for a plain reading that shouldn't count.

```json
{ "id": "cpu", "type": "gauge", "label": "CPU temperature", "value": 72, "max": 100, "unit": "°C",
  "bands": [ { "to": 70, "state": "ok" }, { "from": 70, "to": 85, "state": "warning" }, { "from": 85, "state": "critical" } ] }
```

## bars

[See examples](https://legatobar.com/features#card-bars)

Categories with a value each.

| Field | | |
| --- | --- | --- |
| `label` | required | |
| `items` | required | 1 to 20 of `{ "label", "value", "icon", "url" }`: a label of 1–40 characters, a number of 0 or more, optionally an [item icon](https://legatobar.com/docs/card-fields.md#item-icons) before the label, and optionally a [link](https://legatobar.com/docs/card-fields.md#links-to-other-pages) the whole row opens, such as each project's own page. Once any row links, every row keeps room for its arrow. |
| `unit` | optional | Applies to every value. |
| `max` | optional | The value a full bar stands for, above 0. Left out, the largest item fills its bar. |
| `fit` | optional | `true` shows as many rows as keep the page within the sidebar's length, or the panel's [minimum height](https://legatobar.com/docs/settings.md), at least 5, with **Show *N* more** only when some are left out. Without the sidebar or a minimum height, every row shows. |

One row per item: the label, a bar, the value. Order the items the way the reader thinks about them, largest first for spend, the ballot's order for votes.

```json
{ "id": "spend", "type": "bars", "label": "Spend by category", "unit": "USD",
  "items": [ { "label": "Groceries", "value": 412 }, { "label": "Dining", "value": 188 }, { "label": "Transit", "value": 64 } ] }
```

Bar values include their unit, such as `15 ms` or `18%`. In the Mac app, hover over a shortened row label to read it in full, or right-click it and choose **Copy label**.

## breakdown

[See examples](https://legatobar.com/features#card-breakdown)

What a total is made of: net worth by asset, a month's spend by category against its budget.

| Field | | |
| --- | --- | --- |
| `label` | required | |
| `items` | required | 2 to 6 of `{ "label", "value", "color", "icon" }`: a label of 1–40 characters, a number of 0 or more, and optionally a colour and an [icon](https://legatobar.com/docs/card-fields.md#item-icons). |
| `layout` | optional | `bar`, the default: one bar in segments over a legend. `rows`: a bar for each part. |
| `unit` | optional | Applies to every value. |
| `total` | optional | The headline when it isn't the items' sum, like net worth after debts. Say what it leaves out in `detail`. |
| `target` | optional | A budget the parts fill, above 0. The bar's full width stands for it, and the headline reads "$2,140 of $3,200". |
| `elapsed` | optional | With a `target`, the fraction of the period gone, from 0 to 1, as on a [`pacing`](https://legatobar.com/docs/card-numbers.md#pacing) card. |
| `detail` | optional | A line under the legend, up to 120 characters. |
| `url` | optional | Where a click on the card goes: [another page](https://legatobar.com/docs/card-fields.md#links-to-other-pages) with more, such as a sleep breakdown leading to the nights before it, or an https address. See [Cards that link](https://legatobar.com/docs/card-fields.md#cards-that-link). |

The label and the headline, then one bar split into a coloured segment per item, then a legend: each item's colour, label, value and share of the whole. The segments are in the items' order, so put the largest first unless the reader expects another. A segment too small to see still shows a sliver of its colour.

Without a `target`, the bar is the items' sum and the headline is that sum, or `total`. With one, the bar's full width is the target and the segments fill part of it. A tick marks pace when `elapsed` is set, and a line under the bar says the pace, as a [pacing](https://legatobar.com/docs/card-numbers.md#pacing) bar's does; the header's "$790 of $1,200" says the rest. Like pacing, it never changes the page's status dot.

`color` is one of `blue`, `teal`, `orange`, `purple`, `green`, `pink`, `yellow`, `red`, `rose` or `grey` (`gray` works too). Each Mac draws the system's shade of that colour for light or dark mode, so segments next to each other stay distinct on either background; that's why there's no hex. `purple` is the exception: a deeper violet than the system's, which leans pink. `graphite` is the theme's chart colour. Leave colours out and the items take five category colours in order: blue, aqua, yellow, violet and magenta, picked so neighbours stay apart for colour-blind readers. A colour that sits near one another item names is skipped, and a sixth item and any after it are grey. Name colours when the same category appears on several pages, so Investments is green wherever it's shown.

With `"layout": "rows"`, each part has a row of its own: its label, its segment on a track of its own, the same length it has in the one bar, then its value and share. An item's `icon` sits before its label in the part's colour, as it does in the legend, where it takes the colour dot's place. Rows suit parts you compare with each other, like a night's sleep stages; the one bar suits a single whole, like net worth. For a funnel, where each step is a share of the first rather than of a whole, use [`bars`](https://legatobar.com/docs/card-numbers.md#bars) with a `max`.

```json
{ "id": "sleep", "type": "breakdown", "label": "Sleep a night", "unit": "h", "layout": "rows",
  "items": [ { "label": "Deep", "value": 1.6, "color": "purple", "icon": "moon.zzz" }, { "label": "Core", "value": 4, "color": "blue", "icon": "moon" },
             { "label": "REM", "value": 1.7, "color": "teal", "icon": "eye" }, { "label": "Awake", "value": 0.5, "color": "grey", "icon": "sun.max" } ] }
```

A debt doesn't fit in the bar, since values are 0 or more. For net worth, list the assets and put what's owed in `total` and `detail`:

```json
{ "id": "worth", "type": "breakdown", "label": "Net worth", "unit": "USD", "total": 410000,
  "items": [ { "label": "Real estate", "value": 410000, "color": "blue" }, { "label": "Investments", "value": 268000, "color": "green" },
             { "label": "Cash", "value": 42000, "color": "teal" } ],
  "detail": "After the $310,000 mortgage" }
```

```json
{ "id": "october", "type": "breakdown", "label": "October spend", "unit": "USD", "target": 3200, "elapsed": 0.55,
  "items": [ { "label": "Groceries", "value": 940 }, { "label": "Dining", "value": 620 }, { "label": "Transit", "value": 330 } ] }
```

## flow

[See examples](https://legatobar.com/features#card-flow)

Where amounts go: sources down the left, destinations down the right, and a band from each source to each destination it sends to, as thick as its amount. DNS queries from each client to allowed and blocked, solar and grid to the house and the car, income to spending and savings.

| Field | | |
| --- | --- | --- |
| `label` | required | |
| `links` | required | 1 to 48 of `{ "from", "to", "value" }`: a source's label, a destination's label (each 1–40 characters) and an amount of 0 or more. Up to 6 sources and 8 destinations. |
| `from` | optional | The sources in the order to draw them, as `{ "label", "color" }`. Left out, they're the links' sources in the order they first appear. |
| `to` | optional | The destinations in the order to draw them, as `from`. |
| `unit` | optional | Applies to every amount. |
| `detail` | optional | A line under the chart, up to 120 characters. |
| `hide_amounts` | optional | `true` leaves out the amount under each source's name, so only the names show on the left. The headline total and each destination's share stay. Default `false`. |
| `url` | optional | Where a click on the card goes. See [Cards that link](https://legatobar.com/docs/card-fields.md#cards-that-link). |

The headline is everything that flows. Each source's amount sits under its name, and each destination's share of the whole after its name, so the labels stay outside the bars. Every band is drawn on one scale at both ends. A node is as tall as what passes through it, but never shorter than its label, so a client with a handful of queries still has its name. When `from` or `to` is given, every link has to come from or go to one of them.

Colours are the [breakdown](https://legatobar.com/docs/card-numbers.md#breakdown) names. Sources left without one take the breakdown's category colours in order, skipping any near a colour a source or destination names, and destinations left without one are grey. A band takes its source's colour. Name colours when a destination means something, such as green for Allowed.

```json
{ "id": "queries", "type": "flow", "label": "DNS queries today",
  "to": [ { "label": "Allowed", "color": "green" }, { "label": "Blocked", "color": "grey" } ],
  "links": [ { "from": "Mac Studio", "to": "Allowed", "value": 3680 }, { "from": "Mac Studio", "to": "Blocked", "value": 530 },
             { "from": "Apple TV", "to": "Allowed", "value": 1310 }, { "from": "Apple TV", "to": "Blocked", "value": 650 } ] }
```

From a [source](https://legatobar.com/docs/mapping.md#mapping), map `links` with `each`. A service that lists each source once with two amounts gives two links per row: [derive](https://legatobar.com/docs/mapping.md#derived-values) a list for each destination, then join them with a two-path `each`. Pi-hole v6 lists its top clients with their queries at `/api/stats/top_clients`, and their blocked queries with `?blocked=true`:

```json
"requests": { "clients": "/api/stats/top_clients?count=5", "blocked": "/api/stats/top_clients?blocked=true&count=50" },
"derive": [
  { "name": "rows", "value": { "each": "clients.clients",
      "lookup": { "from": "blocked.clients", "by": "ip", "on": "ip", "as": "b" },
      "fields": { "name": { "if": { "path": "name", "equals": "" }, "then": "ip", "else": "name" },
                  "blocked": { "path": "b.count", "default": 0 },
                  "allowed": { "subtract": [ "count", { "path": "b.count", "default": 0 } ] } } } },
  { "name": "allowed", "value": { "each": "rows", "fields": { "from": "name", "to": { "template": "Allowed" }, "value": "allowed" } } },
  { "name": "blocked_links", "value": { "each": "rows", "where": { "path": "blocked", "gt": 0 },
      "fields": { "from": "name", "to": { "template": "Blocked" }, "value": "blocked" } } }
]
```

```json
{ "id": "clients", "type": "flow", "label": "Queries by client",
  "to": [ { "label": "Allowed", "color": "green" }, { "label": "Blocked", "color": "grey" } ],
  "source": { "ref": "pihole",
    "empty": { "when": { "value": { "count": "clients.clients" }, "equals": 0 }, "text": "No client queries to show." },
    "map": { "links": { "each": [ "allowed", "blocked_links" ],
      "fields": { "from": "from", "to": "to", "value": "value" } } } } }
```

The empty rule handles a successful answer with no clients. A missing client list still needs attention; it does not count as an empty list.

## ranges

[See examples](https://legatobar.com/features#card-ranges)

Rows on one shared scale, each a bar from its low to its high: a week's forecast, a price's range by day. The scale runs from the lowest low to the highest high, so the rows compare at a glance: a cold day's bar sits to the left of a warm one's.

```json
{ "id": "week", "type": "ranges", "label": "This week", "unit": "°F", "colors": "temperature", "items": [
  { "label": "Today", "icon": "cloud.rain", "low": 59, "high": 79, "now": 67 },
  { "label": "Thu", "icon": "sun.max", "low": 55, "high": 72 },
  { "label": "Fri", "icon": "cloud.sun", "low": 48, "high": 66 } ] }
```

| Field | | |
| --- | --- | --- |
| `label` | required | The card's title. |
| `items` | required | 1–14 rows, in order. Each has a `label` (up to 24 characters, like "Today" or "Thu"), a `low` and a `high` (either way round), and optionally an `icon` (an SF Symbol, or `si:`/`site:` as list rows take) `now`, a value marked on the bar with a dot, like the temperature now on today's row, and `info`, up to two short notes (10 characters each) in columns of their own, the first before the icon and the second after it, like a forecast's wind and chance of rain. An empty note leaves its column blank, so the columns stay lined up. |
| `unit` | optional | A degree unit (`°F` or `°C`) shows values as "72°"; a currency shows money. `clock` reads values as hours of the day and shows them as times: 22.5 is 10:30 PM, and 24 and up are the next day's, so a night from 10:56 PM to 8:01 AM is 22.93 to 32.02. A source rule's [`clock`](https://legatobar.com/docs/mapping-tables.md#names-and-exact-times) turns a timestamp into these hours. |
| `colors` | optional | `accent` (the default) draws every bar in the theme's chart colour. `temperature` shades each bar by its own temperatures, purple and blue when cold, through teal and green, to yellow, orange and red when hot, read in the card's unit (`°C`, otherwise °F), so 70°F always looks warm, whatever the rest of the week does. |
| `info_colors` | optional | The `info` columns' colours, in order, by the same names as a [breakdown](https://legatobar.com/docs/card-numbers.md#breakdown)'s: `["green", "blue"]` for wind and rain. Without it they're grey. |
| `muted` | optional | `false` shows each row's low in the text colour instead of grey, like its high. |
| `color` | optional | Every bar in one colour where it means something, such as charges in `green`. The chart colour without; `colors: temperature` shades by temperature instead. |
| `min`, `max` | optional | A fixed scale for every row, such as 0 to 100 for charges that ran from 38% to 72%, so a top-up and a full charge look different. Without them the scale runs from the rows' lowest low to their highest high. |
| `detail` | optional | A note under the rows. |

Full width. From a forecast, map each day with `each`, `{dt\|weekday}` for "Today", "Thu" and so on, and `{wind_deg\|compass}` for a wind's direction; see [Mapping](https://legatobar.com/docs/mapping.md#mapping).

With `unit` `clock`, a week of nights from bedtime to wake-up:

```json
{ "id": "bedtimes", "type": "ranges", "label": "Bedtime and wake-up", "unit": "clock", "items": [
  { "label": "Wed", "low": 22.9, "high": 32.62 },
  { "label": "Thu", "low": 22.91, "high": 31.97 },
  { "label": "Today", "low": 22.94, "high": 32.02 } ] }
```

## columns

[See examples](https://legatobar.com/features#card-columns)

Periods compared side by side, with up to three series in each.

| Field | | |
| --- | --- | --- |
| `label` | optional | Leave it out when the page already says what the columns are. |
| `series` | required | 1 to 3 names of 1–24 characters, in legend order. One series has no legend: the card's label names it. |
| `legend_align` | optional | `leading` (the default) puts the series names under the title; `trailing` puts them at the card's right, on the title's line. |
| `slots` | optional | Room for this many columns, 1 to 96. The columns not here yet are left empty at the end, so a day that's still going draws at its full width: `24` for a day's hours. |
| `summary` | optional | Grey words after the title, on its line: `"**14,623** · **23.3%** blocked"`. Up to 120 characters; inline formatting works. |
| `items` | required | 1 to 48 of `{ "label", "values" }`, oldest first: a period label of 1–12 characters and one number per series, in the same order. |
| `unit` | optional | Applies to every value. A degree unit writes values as "64°". |
| `baseline` | optional | `zero` (the default) starts the columns at zero. `auto` starts them just below the lowest value, for readings like an hour-by-hour temperature, whose shape matters more than how far it is from zero. |
| `values_on_top` | optional | `true` writes each column's value above it, in place of the side axis. |
| `highlight` | optional | The label of the period that applies now, like `"Now"` or this month's `"Oct"`: its label, and its value on top, are bold and bright, while every column keeps its colour. A label no item has highlights nothing. |
| `stacked` | optional | `true` draws one column per period with its series stacked as parts of it, such as a night split into sleep stages. Values on top then show each column's total, and the baseline is always zero. |
| `series_colors` | optional | The series' colours, in order, by the same names as a [breakdown](https://legatobar.com/docs/card-numbers.md#breakdown)'s: `["purple", "blue", "teal"]`. In a stacked chart, `grey` is a lighter grey for the part that isn't the subject, so the other part reads first: Pi-hole's Allowed under Blocked. |
| `grid` | optional | `true` draws lines across the chart at each of the side axis's values. Without it, one faint line marks the middle value. |
| `last_partial` | optional | `true` when the last column is a period still filling, such as the hour now or today. It's drawn lighter, so its shortness doesn't read as a drop. |
| `detail` | optional | A note under the chart, up to 200 characters. |

A legend, then a group of columns per period, with three values up the side: zero, the middle, and the next round number above the tallest column (7,500 for a peak of 6,100), so the columns use the room. Only the top of a column is rounded. Stacked parts have a hairline between them and the legend lists them top first; a column too short to draw its parts is a thin sliver on the baseline, so an almost empty hour doesn't look like a short bar. Without `series_colors`, one series is drawn in the theme's chart colour, and two or more take the [breakdown](https://legatobar.com/docs/card-numbers.md#breakdown)'s category colours in order. Resting the pointer on a period shows its values, and a stacked column's total. An item with fewer values than there are series draws the ones it has. Keep period labels short and distinct, like `May` or `Wk 42`, since they sit under narrow columns. Past 12 columns, only every few labels are written, counted back from the newest, so a day by hour reads every third hour; resting the pointer on a column still names it.

```json
{ "id": "flow", "type": "columns", "label": "Income vs spending", "unit": "USD", "series": ["Income", "Spending"],
  "items": [ { "label": "Aug", "values": [5400, 3980] }, { "label": "Sep", "values": [5400, 4475] }, { "label": "Oct", "values": [3600, 2210] } ],
  "detail": "October is through the 21st." }
```

Stacked, each column is a whole made of its parts, coloured as a breakdown's are:

```json
{ "id": "stages", "type": "columns", "label": "Sleep stages", "unit": "h", "stacked": true, "values_on_top": true,
  "series": ["Deep", "Core", "REM"], "series_colors": ["purple", "blue", "teal"],
  "items": [ { "label": "Wed", "values": [2, 3.8, 1.8] }, { "label": "Thu", "values": [3.5, 2.5, 0.9] }, { "label": "Today", "values": [0.8, 4.7, 1.9] } ] }
```

## tiles

[See examples](https://legatobar.com/features#card-tiles)

A grid of small tiles, four across, each with a label, a value and a change: a watchlist's symbols with their prices and how far each moved today. By default a tile has a light green wash when it's up and a light red one when it's down, a little deeper the further it moved, and the change is written in green or red. With `"style": "quiet"` the tiles stay plain and only the change is coloured, with ▲ or ▼. A change that rounds to zero, or a tile with no change, stays plain either way.

```json
{ "id": "watchlist", "type": "tiles", "max_items": 12, "items": [
  { "label": "NRWD", "value": "$184.62", "change": 2.32, "detail": "Northwind Traders", "url": "legato://page/stock?symbol=NRWD" },
  { "label": "CTSO", "value": "$72.15", "change": -4.51, "detail": "Contoso Systems" },
  { "label": "ZQXJ", "value": "No quote" } ] }
```

| Field | | |
| --- | --- | --- |
| `label` | optional | The card's title. Leave it out in a tab that already names the tiles. |
| `items` | required | Up to 60 tiles, in the order given. Each has a `label` of 1–16 characters, like a symbol, and optionally a `value` (text up to 24 characters, like `"$184.62"` or `"72.15 EUR"`, or a number), a `change` (a number), a `detail` that shows when the pointer rests on the tile, like a company's name, and a `url` that a click opens: https, or `legato://page/ID` for another page. A tile with no `value` shows a dash. On a tile with no `change`, the value can run to two lines, for a note like "Check this symbol". An empty `items` says "Nothing to show yet". |
| `unit` | optional | What follows the change, `%` if left out. Any other unit comes after a space, and `""` shows the number alone. |
| `decimals` | optional | The change's decimal places, 0 to 4, or 2 if left out. |
| `scale` | optional | The change that gets the deepest tint, or 3 if left out. Smaller moves get lighter tints and larger ones the deepest. The scale is fixed, so a quiet day looks quiet. About 3 suits stocks in percent; coins move more, so try 10. |
| `max_items` | optional | Show only the first so many tiles, in order, with Show N more for the rest. |
| `style` | optional | `heat` (the default) washes each tile and colours the change; `quiet` leaves the tiles plain and colours the change, with an arrow. |
| `colors` | optional | `{ "up": …, "down": … }`, by the [breakdown](https://legatobar.com/docs/card-numbers.md#breakdown) names, such as `{ "up": "blue", "down": "orange" }`. Left out: green and red. |

Full width. The card writes the change with its sign, like "+2.32%" or "−4.51%", so map `change` to a number, never to a template. Tiles never count toward the page's status, a section's dot or a notification. VoiceOver reads each tile's label, value, change and detail.

From a source, map each row with `each`. Where there's nothing to compare, a condition with no `else` leaves `change` out and the tile stays plain:

```json
"map": { "items": { "each": "rows", "limit": 60, "fields": {
  "label": "symbol",
  "value": { "template": "${price|round:2}" },
  "change": { "if": { "path": "time", "gt": 0 }, "then": "change_percent" },
  "detail": "name",
  "url": { "template": "legato://page/stock?symbol={symbol|raw}" } } } }
```
