Design guide · kept up to date · started 8 November 2026
How tabelline's pages look, and why
Every page of tabelline is made of a few pieces: two looks, three shapes, a palette by roles, one typeface and a dozen blocks. This page shows each of them live, says what it means and when to use it, and how it is built. It is the reference for writing a new page.
The page is in the look you picked at the top: switch it to see every example in the other one. It is in three parts, and each part's sections carry its colour, a way of showing a long page's parts that this page tries first. The design comes from two devlog posts of 8 November 2026, Reviewing the design and Blocks, not HTML.
Part 1 · Foundations
Two looks
Every page carries two looks, and the reader picks one with the switch in the header; the choice
is remembered. Both are in one style sheet that every page shares, assets/site.css, with its
fonts beside it: nothing loaded from
elsewhere.
- Munari, the default, after Bruno Munari's books on the square, the circle and the triangle: flat paper, one geometric sans, black rules, and colour only where it means something.
- Quaderno, an Italian school exercise book: squared paper, a red margin, headings in blue pen with a highlighter stroke, code on index cards, outputs on sticky notes, tables taped in.
- Minoan, after the frescoes of Crete and Thera and the vases of Athens, for the islands of
the Mediterranean: lime plaster and black glaze, terracotta and dolphin blue, a serif, a running wave
over every table and a meander over the footer. A page offers it in place of the quaderno (
useTabelline(looks = ...)); it was designed in the devlog post Designing a Mediterranean look.
Munari is the page itself: its rules need no script, so a page without JavaScript (or before
its script runs) is Munari. The quaderno is the other look, kept because it shows that a page and
its tables work just as well in a very different theme: everything it changes is scoped by
html[data-tema="quaderno"].
Three rules
- Simplest first. A page starts from zero and goes from the simplest, most fundamental thing to the most complex; a page kept up to date ends with How it is built. Complicare è facile, semplificare è difficile (Munari).
- Shape for kind, colour for role. A shape says what kind of thing it is; a colour says which role it plays. Each shape has a default colour and takes another only for a reason that can be said in words.
- Nothing that only decorates may look like something to press or drag. No dots, holes or knobs on cards. What looks like a button is a button (the look switch, the tabs, Show the parts).
Shapes
- The circle is a place in the page: every
##section and its entry in the indice. Its default colour is the primary; in a page in parts, it takes the colour of its part (as here). - The triangle is a warning, and only that: drawn as a road sign, yellow with an ink edge, so it shows on its own pale yellow note.
- The square is a sheet set apart: a note, a card, a card of a gallery. It is the shape of the sheet itself, drawn as its straight top edge in the colour of its kind (secondary unless a reason says otherwise), never as a separate mark that could look like a checkbox.
A warning: the triangle, on its note.
A sheet set apart, with the square's top edge in the secondary.
The edge takes the colour of the kind: here, done.
The palette, by roles
Each look gives six values: paper, ink, and four colours with a role. Every other colour
is mixed from them in the browser (color-mix(in oklab, …)), so a palette is six values and the
devlog post Munari meets Japan can try others on the page. Munari's
default palette is Haru, spring, from Japan's traditional colour names; the quaderno's
primary is its blue pen and its secondary the red pen.
Neutral
Ten steps from paper to ink, --neutral-0 to --neutral-9 (0, 4, 8, 14, 25, 40, 55, 65, 80
and 100% of ink), and --surface, a sheet a little whiter than the paper. They do most of the
work: the page, the text, rules, code backgrounds, grey text. The steps in use have a name that
says what they are for: the paper and the ink themselves, the shade (step 1), the line (step 3)
and muted, grey text (step 7). Use a name; a step by number only when no name fits.
--paperthe page--shadeoutputs, plain notes--linerules, row lines--mutedgrey text--inktext, edges--surfacecodeFour roles
Each role has the colour itself (--primary), for shapes and edges; a soft version mixed
into the paper (--primary-soft, 22%), for backgrounds; and a text version mixed with ink
(--primary-text, 50%), dark enough to read on paper and on its soft. The warning has no text
version: the warning colour is never text, a warning is ink on its soft, with the triangle.
--primary-softa note of what is missing--secondary-texttext in the secondaryData colours come from the roles too: categorical (the seven tints of the parts of a table,
partTints), sequential (from --paper to --secondary) and diverging (from --secondary
through the paper to --primary). A tabelline colour can be a CSS variable, so a table can use
them directly: style.fill("var(--secondary)").
Rule: never write a fixed colour in a page. Name a token; if none fits, the token is missing
and goes in docs/theme.nim.
Type
- Munari: one sans, Jost (OFL), after the geometric types of the 1920s, for headings and text alike; big and plain.
- Quaderno: Patrick Hand for what is handwritten (headings, labels, the indice), Atkinson Hyperlegible for the text.
- Minoan: Gentium Book Plus (OFL), a serif made for Greek and Latin scholarship, with every letter of the islands' names (ć, ħ, ğ, ḍ, Greek); old-style figures in text, lining ones in tables.
- Code: the system monospace at 13px, smaller than the text; 12.5px under a table.
Part 2 · Blocks
The page and its title
A page is a nimib notebook that calls nb.useTabelline(...) right after nbInit: both looks,
the header with the switch and the masthead, the footer. The masthead is the wordmark, the
section the page belongs to (Guide, Devlog, Stories) and its cadence, how it lives (kept up to
date, one for every release, dated posts); the quaderno writes the same three lines as the label
of an exercise book (nome, materia, classe). A page in two languages (the islands story) adds
EN · IT to the crumbs, the current one underlined, with useTabelline(lang, languages). Then nbTitle opens it with a
kicker (what it is and when; in a post, the date), the title, and a lede that says what the page
gives the reader. Everything below is a block: each section shows one live, with its code folded
under it.
Kicker · kept up to date
A title
The lede: what this page gives you, in a sentence or two.
nbTitle "Kicker · kept up to date", "A title", "The lede: what this page gives you, in a sentence or two."Headings and the indice
## is a section (the circle, in Munari) and goes in the indice; ### is a subsection, in the
primary's text colour, indented in the indice. nbToc puts the indice where it is called,
usually right after the title. Don't go deeper than ###. A long page can be split in parts
with nbPart(number, title, role): from there on, its sections take the part's colour.
On a page with an indice, every heading ends with a small ↑ in a square: it goes back to the
indice, so a long page on a phone is never more than a tap from its contents. It is drawn by
the CSS (.su), so the heading's text, its anchor and a review quote stay the same.
Notes
A note is a sheet set apart, beside the text, in Markdown. Its kind is an enum, NoteKind, so a
kind spelled wrong does not compile; its colour follows from the kind. A page that tells a story
with tables keeps the story in the text and puts what is about the code in green code notes,
one under the table it explains, and a first one that says so.
plain: an aside.
info: information, a page to go to.
done: what is done, what works.
code: about the code, what tabelline does in the table above, and why.
missing: a gap, or a difference from gt and Great Tables.
warning: the API will change.
nbNote "**plain**: an aside."
nbNote "**info**: information, a page to go to.", nkInfo
nbNote "**done**: what is done, what works.", nkDone
nbNote "**code**: about the code, what tabelline does in the table above, and why.", nkCode
nbNote "**missing**: a gap, or a difference from gt and Great Tables.", nkMissing
nbNote "**warning**: the API will change.", nkWarning, "A note can have a title"Cards
Cards in a grid: a menu of pages, as the pages on the home page. A card has a title (a link when it has an address), a small number, a kind (info by default) and any blocks inside.
nbCards "two pages":
nbCard "Guide", "../explainer/", "1":
nbText "A card links somewhere and says in a line what is there."
nbCard "Devlog", "../devlog/", "2":
nbText "Cards of a grid share a kind when they are the same kind of thing."Code and its output
Code that ran is shown on a white sheet (Munari: a black edge; quaderno: an index card), its output under it on grey paper (quaderno: a sticky note). Every block scrolls sideways rather than spilling out of its box. Code fences in Markdown (Nim, Python, R) are highlighted the same way.
let answer = 6 * 7
echo "the answer is ", answer
the answer is 42
Tabs: Nim, Python, R
The same example in three languages: Nim runs, Python (Great Tables) and R (gt) are shown. The tab picked holds for the whole page.
echo 6 * 7
42
print(6 * 7)print(6 * 7)nbTabs("print(6 * 7)", "print(6 * 7)"):
nbCode:
echo 6 * 7Tables
A tabelline table is placed with nbTable and takes optCssTheme(): its colours are the tokens,
so it follows the look (Munari: an ink rule above and below, the primary under the heading; the
quaderno: taped in, on squared paper). nbShowCode shows a table with its code folded under it,
and nbParts adds a switch that shows the parts of the table in their colours.
| Three tabelline | |
|---|---|
| risultato | |
| 2 × 3 | 6 |
| 4 × 5 | 20 |
| 6 × 7 | 42 |
| Three tabelline | |
|---|---|
| risultato | |
| 2 × 3 | 6 |
| 4 × 5 | 20 |
| 6 × 7 | 42 |
- table header: a title and a subtitle (菜の花 nanohana)
- column labels: one per column, with spanner labels over groups of columns (勿忘草 wasurenagusa)
- stub head: the top-left corner, a label for the stub (紅梅 kōbai)
- stub: the row labels (洒落柿 sharegaki)
- row groups: labels that split the rows (藤 fuji)
- table body: the cells, where the data lives (苗 nae)
- table footer: footnotes, marked in the table, and source notes (瓶覗 kamenozoki)
let tre = tableData:
tabellina: ["2 × 3", "4 × 5", "6 × 7"]
risultato: [6, 20, 42]
let t = tabella(tre, rownameCol = "tabellina"):
tabHeader "Three tabelline"
optCssTheme()
nbParts tGalleries
A row of cards to swipe sideways (or scroll with a trackpad): a sequence the reader steps through, simplest first, without making the page long. Each card is one step with a number and a title, and holds any blocks: text, code, the table it makes. Used in Designing tabelline 0.1 and Blocks, not HTML.
One idea
A card holds one step, no more.
Simplest first
The first card is the simplest; each adds one thing.
Side by side
On a phone, one card and the edge of the next are in view.
nbGallery "a gallery: swipe or scroll sideways":
nbGalleryCard "One idea":
nbText "A card holds one step, no more."
nbGalleryCard "Simplest first":
nbText "The first card is the simplest; each adds one thing."
nbGalleryCard "Side by side":
nbText "On a phone, one card and the edge of the next are in view."A heading over a photo
A section's heading can stand over a photo, with nbPhotoHeading: the photo as wide as the text
and low, the heading in the paper's colour over its lower edge on a shade of ink, the circle
still marking the place, and under it, small, who made the photo, its licence and a link to its
source. It is a heading like the others (the indice lists it, ↑ goes back), so a page uses it only
where the photo says something the section is about. The photo is a file in the repository, a
smaller copy of an openly licensed one. Used in Islands of the Mediterranean
and Photos of the Mediterranean, by the story.
nbPhotoHeading "Etna, from orbit", docs / "stories" / "data" / "isole" / "photos" / "story" / "etna-plume.jpg",
"NASA, STS-62 crew, March 1994 · Public domain · [source](https://images.nasa.gov/details/STS062-85-195)",
"Etna's plume, photographed from the Space Shuttle"Source files
Code folded under its name and its length, with nbFoldCode: a whole file, or a part of it from
the line that holds start to the line that holds stop. A page shows the code it talks about
without its length getting in the way. Several in a row make a list. Used in
FOSDEM's data, made with nanuq and Review mode.
docs/stories/r/tabelline.R 44 lines
# What the R cells of a story take for granted: the few things tabelline has and gt has not.
# A story written in R first (to be ported to Nim when the release is built) reads this before
# its first cell (docs/stories/r/run.R).
# tint("--success-soft"): a colour of the page, as tabelline's `tint`. gt takes only named or
# hex colours, so each token is a placeholder hex here, and the page puts `var(--token)` back
# when it is built (blocks.nim, `runR`). The list is `tokenColours` of docs/theme.nim.
tokens <- c("--paper", "--shade", "--line", "--muted", "--ink", "--surface",
"--primary", "--primary-soft", "--primary-text", "--secondary", "--secondary-soft",
"--secondary-text", "--warning", "--warning-soft", "--success", "--success-soft",
"--success-text")
tint <- function(token) {
i <- match(token, tokens)
if (is.na(i)) stop("not a token: ", token)
sprintf("#F0E0%02X", i)
}
# opt_css_theme(): tabelline's `optCssTheme()`, every colour of the table and its font from the
# page, so the table follows the page's look (Munari or quaderno).
opt_css_theme <- function(data) {
gt::tab_options(data,
table.font.names = "var(--font)",
table.font.color = tint("--ink"),
table.background.color = tint("--paper"),
table.border.top.color = tint("--ink"), table.border.top.width = gt::px(3),
table.border.bottom.color = tint("--ink"), table.border.bottom.width = gt::px(3),
heading.border.bottom.color = tint("--primary"),
column_labels.border.bottom.color = tint("--ink"),
column_labels.border.top.color = tint("--ink"),
column_labels.font.weight = "bold",
table_body.hlines.color = tint("--line"),
table_body.border.bottom.color = tint("--ink"),
row_group.background.color = tint("--shade"),
row_group.border.top.color = tint("--ink"),
row_group.border.bottom.color = tint("--line"),
summary_row.background.color = tint("--shade"),
grand_summary_row.background.color = tint("--shade"),
stub.border.color = tint("--line"),
footnotes.border.bottom.color = tint("--ink"),
source_notes.border.bottom.color = tint("--ink"),
heading.title.font.size = "17px", heading.subtitle.font.size = "13px",
source_notes.font.size = "12px", footnotes.font.size = "12px",
table.font.size = "14px")
}docs/stories/r/run.R 63 lines
# Runs the R cells of a story, written in R with gt before tabelline has the features it needs.
#
# Rscript docs/stories/r/run.R < cells.json > outputs.json
#
# Reads `{"page": <name>, "dir": <data dir, from the repository's root>, "cells": [<R code>, ...]}`,
# sources tabelline.R (beside this file), moves to `dir` and runs the cells in order, in one
# environment, like a notebook's. For each cell it writes what it printed and the HTML of its
# last value, if visible (a gt table as `as_raw_html(inline_css = FALSE)`). The page's build
# (`runR` in docs/blocks.nim) calls it only when a cell changed, and keeps the outputs in a
# committed JSON file, so building the site needs no R. gt's random table ids are seeded from
# the page's name, so a second run gives the same HTML.
suppressPackageStartupMessages({
library(jsonlite)
library(gt)
})
args <- commandArgs(trailingOnly = FALSE)
here <- dirname(normalizePath(sub("^--file=", "", args[grep("^--file=", args)])))
root <- normalizePath(file.path(here, "..", "..", ".."))
shown <- function(value) {
if (inherits(value, "gt_tbl")) {
h <- as.character(gt::as_raw_html(value, inline_css = FALSE))
return(gsub("@import url\\([^)]*\\);?", "", h)) # nothing remote in the pages
}
text <- paste(utils::capture.output(print(value)), collapse = "\n")
paste0("<pre class=\"nb-output\">", htmltools::htmlEscape(text), "</pre>")
}
run <- function(code, env) {
exprs <- parse(text = code, keep.source = FALSE)
value <- NULL
visible <- FALSE
printed <- utils::capture.output({
for (k in seq_along(exprs)) {
r <- withVisible(eval(exprs[[k]], env))
value <- r$value
visible <- r$visible
if (k < length(exprs) && visible && !inherits(value, "gt_tbl")) print(value)
}
}, type = "output")
list(printed = paste(printed, collapse = "\n"),
html = if (length(exprs) > 0 && visible) shown(value) else "")
}
main <- function() {
invisible(Sys.setlocale("LC_ALL", "C.UTF-8")) # the data has accents and dashes
req <- fromJSON(paste(readLines(file("stdin"), warn = FALSE), collapse = "\n"),
simplifyVector = FALSE)
set.seed(sum(utf8ToInt(req$page) * seq_along(utf8ToInt(req$page))) %% .Machine$integer.max)
env <- new.env(parent = globalenv())
sys.source(file.path(here, "tabelline.R"), envir = env)
setwd(file.path(root, req$dir))
outputs <- lapply(req$cells, function(code) {
tryCatch(run(code, env), error = function(e)
list(printed = "", html = "", error = conditionMessage(e)))
})
cat(toJSON(list(gt = as.character(packageVersion("gt")),
r = paste(R.version$major, R.version$minor, sep = "."),
outputs = outputs), auto_unbox = TRUE, null = "null"))
}
main()docs/review.nim 21 lines
proc review*(nb: var Nb, page = "", title = "", source = "", script = "", css = true) =
## See `nbReview`. `css = false` leaves the styles out, for a site that puts `reviewCss` in
## its shared style sheet.
let file = nb.doc.thisFile.string
let s = reviewSettings(file, repoRoot(file), (if title.len > 0: title else: nb.doc.context{"title"}.getStr),
page, source)
let v = gitVersion(file)
if css:
nb.doc.context["stylesheet"] = %(nb.doc.context["stylesheet"].getStr & "\n<style>\n" & reviewCss & "</style>")
nb.add newNbReview(page = s.page, title = s.title, source = s.source,
number = v.number, commit = v.commit, updated = v.updated, script = script)
template nbReview*(tpage = "", ttitle = "", tsource = "", tscript = "") =
## The review mode on this page. Reading is the default: the page shows its version, from git
## (*Version 12 · updated 10 Nov 2026*), under its lede or title, and **✎ Review** beside it,
## which opens and closes the review mode. With no arguments, everything comes from the
## notebook: its source file (named in the export, and the key the comments are kept under in
## the browser), its title and its version. `tpage` keeps the key when the file is renamed;
## `tscript` is the address of a shared `review.js`: empty, the script is inlined and the page
## stays one file.
nb.review(tpage, ttitle, tsource, tscript)nbFoldCode "docs/stories/r/tabelline.R"
nbFoldCode "docs/stories/r/run.R"
nbFoldCode "docs/review.nim", start = "proc review*", stop = "newNbBlock(NbVersion):"Review mode
Every page has a review mode (docs/review.nim, turned on by useTabelline; tried in
Review mode). Reading is the default: the page shows only its version
line under the lede, Version 9 · updated 10 Nov 2026 in bold ink, and
a light button beside it, ✎ Review, in plain outline; open, it keeps its outline in ink with a
line of the secondary under it. While reviewing, a bar is fixed at the bottom, in the surface
colour under a rule of ink, with buttons at least 44 pixels high, the one to comment in ink; the
comment that is open sits in a comment box at the top, where the phone's keyboard does not cover it.
A commented text is marked in the secondary's soft colour with a line under it, a note set
apart; the one open is in the secondary itself. In the quaderno, marks are the highlighter,
underlined in red pen. nbInReview holds blocks shown only while reviewing; nbVersion() moves the version line
where it is called. nbDrawing puts a drawing made with diagrammari in the page's colours, and so a map
made from a story's data (an SVG with class map: the sea in the surface, the land a neutral, the
main places in the secondary, the others a dot of the primary, names in ink and seas in muted italics),
and nbFoldCode folds long code (see Source files). The review mode's styles are reviewCss, in docs/review.nim, from the tokens
when the page has them.
Swatches, quotes and highlights
nbSwatches shows colours beside their names, as in the palette above: a token or any CSS colour,
a name and what it is for.
A quote has a grey edge in Munari, and is a sticky note in the quaderno.
A highlight is the warning's soft yellow: a highlighter pen, never a shape, so it can't be taken for the triangle.
Part 3 · Writing and building
Writing a page
- Order from the simplest and most fundamental to the most complex, from zero.
- Put small examples side by side, or in a gallery, rather than one long column.
- Write code in the order the reader meets it: define a value before using it.
- Use blocks. Markdown in
nbText, nimib's blocks,nbTable, and the blocks above. No HTML innbText, no CSS and no colours in a page. When something is needed a second time, it becomes a block indocs/blocks.nim, with its CSS indocs/theme.nim.nbRawHtmlis a last resort, for a one-off, with a comment that says why. - Check every new element in both looks, and at phone width (390px): nothing may be wider than the screen.
- A page of the site is kept up to date; a devlog post is dated, and its numbers are frozen as snapshots so it does not change afterwards.
nim r tools/drift.nim counts, page by page, the HTML, styles, scripts and fixed colours written
outside the blocks and the style; CI fails when a page has more than its count in
tools/drift.tsv (the dated posts keep what they had, and the counts only go down).
Open questions
- Tables wider than a phone: some tables of the explainer push the page wider than 390px; wide tables should scroll in their own box (a BACKLOG item).
- Coloured parts, tried first on this page: do they help a long page, or distract?
- A Markdown backend for the blocks, so a page can also be a README.
How it is built
The palette. docs/theme.nim holds every styling decision. Each look is six values (a
Look): Munari's are CSS variables named after where they go (--m-carta, --m-cerchio, …) so a
palette can be swapped on the page; the quaderno's are fixed. From them, one rule on html
derives every token with color-mix(in oklab, …): --neutral-0 to --neutral-9 and the names
of the steps in use (--shade, --line, --muted), --surface, and a soft
and a text version of each role. The CSS of both looks and of every block uses only the tokens;
the quaderno keeps a few motifs of its own (the squares, the margin, the post-it, the tape).
Munari's rules are written plain, as the page's own; the quaderno's are written once without a
scope, and theme.nim puts html[data-tema="quaderno"] in front of every selector when it builds
the CSS, so they win over Munari only in the quaderno.
The blocks. docs/blocks.nim makes each block with nimib's newNbBlock: a type with
fields and a toHtml that writes classes, never styles. A leaf block (nbNote, nbTitle,
nbSwatches) is a func that adds it and a template that calls the func. A container (nbCards,
nbGallery, nbTabs, nbShowCode) inherits from NbContainer: its template opens it with
nb.withContainer so the blocks of its body go inside, and its toHtml renders them with
nbContainerToHtml. The indice is a block too: when the page is saved it reads every ## and
### of the page's text blocks, and the part each is in.
The page. useTabelline puts the fonts (base64 @font-face) and the CSS into one <style>,
and replaces nimib's header, footer and text partials: the text partial adds ids to headings and
highlights code fences. A few lines of script in the <head> set data-tema on <html> before
the page is drawn (from ?tema=, else localStorage, else munari); one script at the end makes
the switch, the tabs, Show the parts and the specs filter work.
Tables. optCssTheme() is a tabelline preset that reads the tokens by name (--ink,
--paper, --line, --shade, --primary, --font), each with a plain fallback
(var(--ink, #1C1C1C)), so a table follows the page it is on with no arguments.
