Cards

Text and layout

Reference for the text, link and code cards, and for heading and tabs, which arrange the cards around them.

text

A note, or a callout.

Field
labeloptionalA heading above the note.
bodyrequired without buttons1–500 characters, with inline formatting. A card with a source and buttons can leave it out, for a card that is only its label and buttons, such as a machine's Controls.
toneoptionalneutral (the default), info, success, warning or critical.
iconoptionalAn SF Symbol name, drawn before the body in the tone's colour.
styleoptionalplain (the default), quote, which draws the body as a quotation with a bar down its leading edge in the tone's colour, or cover, which makes the card a page's front: the label large, the body under it. Use cover for a page's first card only.
filloptionalblue, sky, lilac or green: a soft tint with a fine grain behind the card, in place of the tone's, deeper in dark mode. For a page's cover or a note that opens a page. A fill never means a state and never changes the page's status; use a tone or a status card for that.
noteoptionalA short reading at the right of the title's line, up to 40 characters, such as "68° in · 66° out" beside a car's Climate buttons. One line, usually filled from a source. Needs a label.

Any tone but neutral adds an icon and tints the card; icon replaces that icon with your own, which with a tone makes a callout, like 👋 at the top of a page. Tones never change the page's status dot; use a status card when something needs attention.

json
{ "id": "note", "type": "text", "body": "Dining is 18% over pace.", "tone": "warning" }
{ "id": "hello", "type": "text", "tone": "info", "icon": "hand.wave", "body": "**Welcome.** Ask your assistant for a page; see [the quickstart](https://legatobar.com/docs/quickstart)." }
{ "id": "said", "type": "text", "style": "quote", "body": "**12 of 16** sessions were false alarms." }
{ "id": "cover", "type": "text", "style": "cover", "fill": "blue", "label": "Home lab", "body": "Three servers, the network and the backups." }

Inline formatting

A text card's body, a list's items, a checklist item's text and detail, and a heading's text take Markdown's inline formatting:

WriteShows
**bold**bold
*italic* or _italic_italic
~~gone~~gone
`code`code, in a monospaced font
[the docs](https://legatobar.com)a link; only https links and legato://page/ID open, others show their words

Block Markdown (headings, - lists, code fences) shows as written: use a list with a style, or a code card, for those. To keep a literal * or _, write \* or \_. For text a source fills from a service, such as an error's title, the verbatim filter does this for every mark. Older versions of the Mac app show the formatting characters as they are.

A button that opens a web page, with an optional icon and a second line.

Field
labelrequiredThe button's text.
urlrequiredAn https:// URL with no spaces, up to 2048 characters, or legato://page/ID.
detailoptionalA second line under the label, up to 120 characters: a song's name, what's at the link.
iconoptionalAn SF Symbol name in place of the default compass, like music.note or doc.text.
toneoptionalColours the icon: info blue, success green, warning orange, critical red. Default neutral.
layoutoptionalbutton (the default) or tile.

The button shows the label and the URL's host, and opens the URL in the browser only when you click it. Only https URLs with a host are accepted, and the Mac checks again before opening one. A link to another page shows that page's name in place of the host.

json
{ "id": "pr", "type": "link", "label": "Open the pull request", "url": "https://github.com/example/app/pull/482" }
{ "id": "listen", "type": "link", "label": "Music while you look around", "detail": "The Meadows - A Place To Rest",
  "icon": "music.note", "tone": "success", "url": "https://open.spotify.com/track/3tCCbZaqd3GPy7jcWibXKq" }

With "layout": "tile", a link card is half width, like a stat, and pairs with the half-width card after it. Its icon (in the accent colour unless tone says otherwise) sits beside the label, with the detail under it. The whole card is the link, lit with its arrow under the pointer, as cards that link are. Tiles suit a grid of places to go that each show a line of state, like rooms and how many lights are on; a source can fill the detail. A tile whose page is missing isn't a link.

json
{ "id": "kitchen", "type": "link", "layout": "tile", "label": "Kitchen", "detail": "2 lights on", "icon": "fork.knife",
  "url": "legato://page/kitchen" }

code

A block of code or a command: a config fix, a curl to try, a log excerpt.

Field
labeloptionalA heading above the code.
languageoptionalA short name shown as a small label, like yaml, bash or json: 1–24 characters of a–z, 0–9, +, #, . and -.
coderequired1–4,000 characters, shown exactly as written, line breaks and spaces included.

Full width, in a monospaced font with a Copy button. Long lines scroll sideways rather than wrap, and past about 16 lines the block scrolls down too. The code isn't coloured. Older versions of the Mac app show a card saying they can't draw it.

json
{ "id": "fix", "type": "code", "label": "The fix", "language": "yaml",
  "code": "trigger:\n  - platform: numeric_state\n    above: 3.0\n    for: \"00:01:30\"" }

heading

A section title that splits a long page into parts.

Field
textrequiredThe title: 1–80 characters, with inline formatting.
detailoptionalA line under the title, up to 120 characters.
iconoptionalAn SF Symbol name before the title, in the accent colour.
collapsedoptionaltrue starts the section closed. Default false. A closed section opens by itself when its page comes into view with a critical card inside, or when the page's first answer arrives just after you open it and is critical. On a page with params, each item keeps its own open and closed sections. A section you close yourself stays closed while it's critical. Once it has been ok or a warning and turns critical again, it opens on your next visit.
cardsoptionalThe ids of the cards its section holds, which come right after the heading, in any order. The cards after them stay on the page outside the section. Without it, every card up to the next heading.

Full width, larger than a card's label, with no card around it. The cards after a heading, up to the next heading, are its section: a click on the heading closes or opens them, and a chevron at its right says which. A section that starts closed suits detail someone might want, like a second option or a long log, without it taking the page. The Mac remembers a click while Legato runs; the next write keeps it. Cards in a closed section still count toward the page's status and notifications. A heading whose cards all go in Details ("placement": "page_info") isn't drawn.

A section can hold just a few cards. List them in cards, and the heading opens and closes only those; the cards after them carry on as part of the page, outside it. Here the host and its nightly backup share a section and a dot, and the charts after them don't:

json
{ "id": "health", "type": "heading", "text": "Health", "cards": ["host", "backup"] }
{ "id": "host", "type": "status", "label": "pve-lab", "state": "ok" }
{ "id": "backup", "type": "status", "label": "Nightly backup", "state": "ok" }
{ "id": "cpu", "type": "sparkline", "label": "CPU", "points": [7, 9, 8] }

A heading whose section holds status, gauge or fleet cards has a dot before its chevron, open or closed, in the colour of the worst of their states: green when all are OK, grey for unknown, orange or red when one needs attention. Cards in every tab of a tabs card in the section count, as they do for the page's status. A section with no such cards has no dot.

json
{ "id": "found", "type": "heading", "text": "What I found", "icon": "magnifyingglass", "detail": "A week of history" }
{ "id": "option-b", "type": "heading", "text": "Prefer an instant response?", "detail": "Option B", "collapsed": true }

tabs

Two to five tabs in one place on the page, each with its own cards. A click on a tab's name shows its cards in place of the others'.

Field
tabsrequired2–5 tabs, left to right. Each is {label, cards}.
tabs[].labelrequiredThe tab's name: 1–24 characters, like Hacker News or This week.
tabs[].cardsrequired1–12 cards, laid out as a page's are, so two half-width cards share a row. Any type but tabs and heading.
same_heightoptionaltrue keeps every tab at the height of the tallest, so switching tabs never moves the cards below. The shown tab's last card stretches to fill the room. Without it, each tab is as tall as its own cards.
countsoptionaltrue follows each tab's name with how many its first list holds: the list's total when it has one, else its lines. The tabs then double as the totals: All 74,628, Blocked 15,000.
searchoptionalA search field at the end of the tab names, for a page with params: param names the one the words go in, prompt is its grey placeholder (up to 24 characters), and match is contains (the default), which sends the words between * wildcards, or exact. Return opens the page with them, and the clear button goes back to the param's default. The field shows what the param holds now, so a link that filtered the page shows its filter.

Full width. The names sit in a row like card labels: the one showing in bold with the accent colour under it, the others lighter. Names that don't fit scroll sideways.

Give "same_height": true to tabs of lists that change length, such as Due, Upcoming and Inbox: a short list then keeps the long one's height instead of pulling the page up.

Leave it off when the tabs are the last card on the page, since nothing below them can move. Leave it off too when one tab is much taller than the others: a short tab, such as a chart, then sits at the top of a mostly empty card.

The first tab shows until someone picks another. Legato remembers the selected position for that page and card across launches.

Labels may repeat. Renaming or reordering tabs keeps the same position selected; if that position no longer exists, the first tab shows. Saved choices contain positions, not tab labels.

Tabs suit views of one thing that would otherwise stack down the page: several feeds, today against this week, one server or repository each. Cards in a tab that isn't showing still count. Their status, gauge and fleet states count toward the page's status and notify as on the page, a tab whose cards need attention has an orange or red dot after its name, and Spotlight and Shortcuts read them.

Card ids are unique across the whole page, cards in tabs included. A tabs card counts as one of the page's 24 cards, since only one tab shows at a time; the cards in its tabs don't, up to 120 cards on the page in all. Older versions of the Mac app show a card saying they can't draw it.

json
{ "id": "servers", "type": "tabs", "tabs": [
  { "label": "Today", "cards": [
    { "id": "requests", "type": "stat", "label": "Requests", "value": "1.2M" },
    { "id": "errors", "type": "stat", "label": "Errors", "value": 31 } ] },
  { "label": "Web", "cards": [
    { "id": "web-1", "type": "status", "label": "web-1", "state": "ok" },
    { "id": "web-2", "type": "status", "label": "web-2", "state": "critical", "detail": "Not answering" } ] },
  { "label": "Database", "cards": [
    { "id": "db", "type": "status", "label": "Primary", "state": "warning", "detail": "Replica lag 40s" } ] }
] }