The Quiet kit
Quiet is a calm, centred email design: a serif display face, a logo at the top, generous white space and a footer on a grey ground. It was lttr's only design before v0.2.0. Now it is a kit like any other, in the Go package github.com/sulv-io/lttr/kits/quiet, with 24 components, Go types for money, receipts, stock and products, and a few template functions of its own.
examples/quiet uses it for nine reference emails for Loam, a fictional farm-to-door marketplace. Those nine are lttr's conformance suite: their HTML and text are compared byte for byte with golden files, and they are the Quiet half of the Gallery.
Use it
Import the package and compile against quiet.MustKit(). The kit loads once, with its types and functions registered, and every call returns the same *kit.Kit:
package main
import (
"fmt"
"log"
"net/mail"
"github.com/sulv-io/lttr"
"github.com/sulv-io/lttr/kits/quiet"
)
// OrderPacked is the template's data. The receipt component binds a
// quiet.Receipt, so the order field has exactly that type.
type OrderPacked struct {
OrderID string `json:"order_id"`
Order quiet.Receipt `json:"order"`
Track string `json:"track_url"`
}
const src = `---
template: order.packed
profile: buyer
subject: "Order {{order_id}} is packed"
preheader: "It leaves the farm this afternoon."
---
::statement{eyebrow="Order {{order_id}}"}
# Packed and ready.
Your box leaves the farm this afternoon.
:button[Track delivery]{href="{{track_url}}"}
::
::receipt{:order="order"}
::
::signoff
::
`
var orderPacked = lttr.MustCompile[OrderPacked](quiet.MustKit(), "order.packed", []byte(src))
func main() {
r, err := lttr.NewRenderer(lttr.Config{
Kit: quiet.MustKit(),
Profiles: []lttr.Profile{{Name: "buyer", From: mail.Address{Name: "Loam", Address: "orders@loam.example"}}},
AssetBase: "https://loam.example/assets/email",
Vars: map[string]string{
"brand": "Loam",
"site": "https://loam.example",
"help": "https://loam.example/help",
"prefs": "https://loam.example/preferences",
"address": "12 Mill Lane, Alder Valley",
},
})
if err != nil {
log.Fatal(err)
}
m, err := orderPacked.Render(r, lttr.Recipient{Address: "ada@example.com", Name: "Ada"}, OrderPacked{
OrderID: "LM-2291",
Order: quiet.Receipt{
Lines: []quiet.ReceiptLine{
{Name: "Autumn veg box", Detail: "Large", Qty: 1, Amount: quiet.USD(3400), Tone: quiet.ToneWarm},
{Name: "Heritage apples", Detail: "2 kg", Qty: 2, Amount: quiet.USD(1180), Tone: quiet.ToneSea},
},
Fees: []quiet.Fee{{Label: "Delivery", Amount: quiet.USD(500)}},
Total: quiet.USD(5080),
},
Track: "https://loam.example/orders/LM-2291",
})
if err != nil {
log.Fatal(err)
}
fmt.Println(m.Subject)
fmt.Println()
fmt.Print(m.Text)
}
Order LM-2291 is packed
LOAM
ORDER LM-2291
Packed and ready.
Your box leaves the farm this afternoon.
Track delivery:
https://loam.example/orders/LM-2291
Autumn veg box x1 ............... US$34
Heritage apples x2 .............. US$11.80
Delivery ........................ US$5
Total ........................... US$50.80
Thanks,
The Loam team
Questions? Reply to this email or visit the Help Centre
(https://loam.example/help).
--
Loam · 12 Mill Lane, Alder Valley
Notification settings: https://loam.example/preferences
Three things are specific to Quiet:
- Set
AssetBase. The header showslogo.png, andlogo-dark.pngin dark mode, from the asset base, and Quiet has no default for it. Without one, every render fails at the logo:layout.html:28:102: error calling url: url "/logo.png": relative url not allowed. The kit's placeholder logos are inquiet.Files()underassets/. Host your own logos under those two names. - Set the brand vars. The header, footers and sign-off read the brand name, links and address from kit vars. They ship with neutral defaults (
Quiet,https://example.com), so set them withConfig.Vars. The vars table lists them. - Name profiles after the footers you want. The layout picks the footer from the profile's name, so a profile called
buyergets the service footer and one calledpromothe marketing footer. See Choose a footer with the profile.
quiet.USD(3400) prints US$34: whole amounts drop their decimals. Set Symbol for another prefix, as Loam does with quiet.Money{Minor: 3400, Currency: quiet.USDCode, Symbol: "$"}, or use quiet.Exact to always show two decimals.
Set the brand vars
Every var has a default in the kit's kit.yaml. Config.Vars overrides any of them per renderer. A key the kit doesn't declare is a NewRenderer error.
| Var | Default | Used in |
|---|---|---|
brand | Quiet | The logo's alt text, "The {brand} team" in signoff, the footer address line and several footer sentences |
site | https://example.com | The marketing footer's nav row (Shop, Sell, the journal) |
domain | example.com | The newsletter footer: "You're getting {journal} because you subscribed on {domain}." |
help | https://example.com/help | "Visit the Help Centre" in the service footer, and Help in the nav row |
prefs | https://example.com/preferences | Notification settings and Preferences links |
address | 1 Example Street | The address line of every footer: "{brand} · {address}" |
region | your region | The promo footer: "…subscribed to {brand} updates for {region}." |
journal | Journal | The newsletter masthead ("{journal} · No. {issue}") and the nav row |
about.buyer | your order | "This is a service email about …" for the buyer profile |
about.seller | your seller account | The same, for seller |
about.driver | your driver account | The same, for driver |
asset_base | none | The logos. Set it with Config.AssetBase, not Vars. |
Choose a footer with the profile
A Profile in lttr only says who a message is from and which headers it carries. Quiet's layout.html reads the profile's name (.Doc.Profile.Name) and picks the header and footer from it:
| Profile name | Footer | Header |
|---|---|---|
buyer, seller, driver, security and any other name | Service: a note, "This is a service email about …" with Notification settings, then the address | Logo |
announcement | Marketing without the nav row. With frontmatter legal: true, the service footer instead | Logo |
newsletter, promo | Marketing: the nav row (Shop, Sell, the journal, Help), the reason with Unsubscribe and Preferences links, then the address | Logo |
b2b | Outreach: the address, then an opt-out line | Logo |
internal | Internal: "Internal. Do not forward outside {brand}.", then the address | The "Internal · Do not forward" banner above the logo |
Any template with frontmatter issue: also gets the newsletter masthead under the logo, "{journal} · No. {issue}".
The marketing footer links the recipient's UnsubscribeURL, so rendering a marketing template for a recipient without one fails: layout.html:79:38: error calling url: url "": empty. Set ListUnsubscribe: true on those profiles too, so the message carries the RFC 8058 one-click headers. See Profiles and config.
The default copy changes with the profile. Seller mail says "Questions? Reply to this email.", security mail says "{brand} will never ask for your password or this code by phone or chat." and has no service line, and everything else points to the Help Centre. A template changes the copy with the frontmatter keys Quiet declares:
| Key | Type | Replaces |
|---|---|---|
note | inline Markdown | The first line of the service footer |
about | text | What "This is a service email about …" names |
reason | inline Markdown | The marketing footer's "You're getting this because …" line |
optout | inline Markdown | The outreach footer's opt-out line |
nav | flag, default true | nav: false drops the marketing nav row |
legal | flag | On an announcement, switches to the service footer |
issue | text | Adds the masthead, "{journal} · No. {issue}" |
---
template: payout.sent
profile: seller
subject: "Payout sent: {{amount}}"
preheader: "{{order_count}} orders, {{period}}. In your bank within 48 hours."
note: Questions about this payout? Reply to this email.
---
See Frontmatter for the core keys every kit has.
Browse the components
Quiet has 24 components. 22 of them stand at the top level, and two, story and product, only nest inside stories and products. Each keeps the short ID it had in lttr v0.1 as an alias, so ::k1 is ::statement. Names and aliases are case-insensitive.
Two limits apply across a template. It may have at most one :button (more than one :button in the template), and letter, where loose Markdown goes, takes :link but no :button (letter: :button is not allowed here).
Heroes
The opening block of most emails: centred, with the largest type.
| Component | For | Attributes and content | Example |
|---|---|---|---|
statement · k1 | The headline block | eyebrow; tone="orange" for an accent eyebrow; size="xl" for the large h1. At most one heading (h1–h3), then paragraphs, lists and one action row | ::statement{eyebrow="Order {{order_id}}"} |
figure · k2 | A big amount | amount (required), eyebrow, usd for a line under the amount. Paragraphs | ::figure{eyebrow="Weekly payout · {{period}}" amount="{{amount}}"} |
offer · e3 | A discount code | eyebrow. Exactly a ## heading, whose code span is the code, then one small terms paragraph | ::offer{eyebrow="This week only"} |
Bands
Full-width images with no side padding and no text form.
| Component | For | Attributes and content | Example |
|---|---|---|---|
image · k3 | A hero image | src, alt (required with src), height (default 340), tone (warm, sea, sun, map) for the ground shown without src. No content. Must directly follow a statement | ::image{src="{{hero_image}}" alt="Rows of young apple trees on a hillside" tone="warm"} |
map · t4 | A static map | src, height (default 260), and alt or both pickup and dropoff (the alt is then "Map from {pickup} to {dropoff}"). No content | ::map{src="{{map_url |}}" pickup="{{pickup_area}}" dropoff="{{dropoff_area}}"} |
Quiet doesn't fetch maps. Render the image with your map provider, host it, and pass its URL in your data. {{map_url |}}, with an empty fallback, lets the URL be empty, and the band then shows its map ground.
Tables
Rows of labels and values, 32 px above and below.
| Component | For | Attributes and content | Example |
|---|---|---|---|
receipt · t1 | An order summary | Binds order, a quiet.Receipt (required): lines with thumbnails, fees, the total and an optional ≈ US$ line. total_label overrides the label | ::receipt{:order="order"} |
stock · t5 | Stock left | Binds items, a []quiet.StockItem (required): name and SKU against "N left", or "Out of stock" in red | ::stock{:items="stock"} |
breakdown · b4 | A two-column money table | One table of two columns. Its header row is a body row, and the last column is right-aligned | ::breakdown then | Sales · {{order_count}} orders | {{sales}} | |
compare · b5 | Before and after | One table of up to three columns, with a header row. With three, the middle column is small. **x** in a value cell is a bold teal value | ::compare then | Commission | Now | From 1 Nov | |
table | Any small table | One table of up to four columns, aligned as the Markdown says. headless makes the header row a body row | ::table then | Date | Where | Time | |
Body copy
Left-aligned reading text.
| Component | For | Attributes and content | Example |
|---|---|---|---|
letter · b1 | Paragraphs of prose | Paragraphs, ### headings, lists and a row of :links. Loose Markdown between components goes here: it is the kit's default | Any Markdown outside a component |
meta · t3 | Details, two to a row | One to four ### Label and paragraph pairs. A soft line break in a paragraph is a line break | ::meta then ### Deliver to |
quote · e2 | A pull quote | cite. One paragraph, in italic serif | ::quote{cite="Ruth Calloway · Hollow Oak Farm"} |
notice · b2 | A bordered aside | title; tone="warn" for the warning ground. One or two paragraphs | ::notice{title="Didn't ask for this?"} |
Tails
Blocks that close off a hero: no padding above.
| Component | For | Attributes and content | Example |
|---|---|---|---|
progress · t2 | A step tracker | 2 to 5 steps, from steps (a comma-separated list) or the :steps binding (a []string), not both. current is a step name or a 1-based number, and may be a merge tag | ::progress{steps="Confirmed, Packed, On its way, Delivered" current="On its way"} |
code · b3 | A one-time code | value (required), shown large with its spaces removed. An optional expiry paragraph | ::code{value="{{otp_code}}"} |
actions · c1 c2 c3 | A row of actions on its own | Exactly one action row: a :button, a :button and a :link, or a :link | ::actions then :button[View payout]{href="{{payout_url}}"} |
Tiles
Grids of two tiles to a row, for newsletters and campaigns. In the text part, each tile is a block of its own: the title or the name and price, then its link.
| Component | For | Attributes and content | Example |
|---|---|---|---|
stories · e1 | Story tiles | One to four :::story children, with a hairline between rows | ::stories |
story | One story tile | href (required), eyebrow, image, alt, cta (default Read), tone. One paragraph, the title. Only inside stories | :::story{eyebrow="Grow" href="https://loam.example/notes/cold-frame" tone="sea"} |
products · e4 | Product tiles | Binds items, a []quiet.Product, or up to four :::product children, not both. cta (default Buy) | ::products{:items="products"} |
product | One product tile | name, price and href (required), image, alt, cta, tone. No content. Only inside products | :::product{name="Heritage apples" price="$6" href="https://loam.example/p/apples"} |
Sign-offs and rules
| Component | For | Attributes and content | Example |
|---|---|---|---|
signoff · s2 | The team sign-off | closing or one paragraph, not both ("Thanks," without either). name, default "The {brand} team" | ::signoff{closing="Thanks for growing with us,"} |
signature · s1 | A personal sign-off | name (required), role, contact | ::signature{name="Nadia Brennan" role="Restaurant Partnerships, Loam"} |
divider | A hairline between blocks | No content and no text form | ::divider |
Every component's schema is in kits/quiet/components/<name>/component.yaml. Component schemas explains the keys.
Know the spacing rules
Templates never set margins. Each component's spacing in its schema says how much padding it has above and below, and the engine resolves the whole stack in three passes:
- Each component starts with its own
topandbottom. - A component's
afterrules apply when it directly follows a named component or a component of a class (.hero,.band,.tabular). They can set itstopandbottomand, withprev_bottom, the previous component's bottom. - Position rules win: the first component's
firstedge, then the last component'slastedge.
What that means in Quiet:
| Component | Padding (px) | Rules |
|---|---|---|
Heroes (statement, figure, offer) | 40 above, 36 below | 40 below when last |
Bands (image, map), tiles, divider | 0 | Full bleed |
receipt, stock, breakdown, compare, table | 32 above and below | 0 above after a figure or meta, and the figure gets 32 below. receipt and compare set a statement before them to 24 below, table to 16 |
letter | 32 above, 28 below | 36 above when first |
meta | 0 above, 32 below | 32 above after a band |
notice | 0 above, 32 below | 40 below when last or after a band |
quote | 40 above and below | |
progress | 0 above, 8 below | Sets a hero before it to 28 below |
code | 0 above, 40 below | Sets a hero before it to 0 below |
actions | 0 above, 40 below | 8 above after any of the five tables |
signoff, signature | 0 above, 36 below |
The view hands the resolved values to the template as .Section.Top and .Section.Bottom. See Component schemas for the spacing keys.
Bind the Go types
Four components bind Go values. The kit registers these types, and a binding must have exactly its type:
| Type | Bound by | Holds |
|---|---|---|
quiet.Receipt | receipt :order | Lines []ReceiptLine, Fees []Fee, Total Money, an optional TotalUSD *Money and TotalLabel |
[]quiet.StockItem | stock :items | Name, SKU and Left for each item |
[]quiet.Product | products :items | Name, Price Money, Href, Image and Tone for each tile |
[]string | progress :steps | The step labels |
quiet.Money is an amount in minor units with a currency, and prints through String(), so it works in merge tags too: Loam's {{amount}}, a quiet.Money with Symbol: "$", prints $1,019.90. quiet.Exact always shows two decimals, and Money.Approx() rounds to whole units with a ≈ prefix. See the API reference for every type and method.
See the nine Loam emails
examples/quiet is the package to copy from: profiles.go has the nine profiles, config.go the vars and Config, templates/ the nine templates and samples.go a typed data type and sample for each.
| # | Template | Profile | Components |
|---|---|---|---|
| 01 | order.out_for_delivery | buyer | statement, progress, receipt, meta |
| 02 | payout.sent | seller | figure, breakdown, actions, signoff |
| 03 | auth.reset | security | statement, code, notice |
| 04 | notes.digest | newsletter | statement, image, stories, divider, quote |
| 05 | campaign.harvest_week | promo | statement, image, products, divider, offer |
| 06 | job.offered | driver | statement, map, meta, breakdown |
| 07 | fees.change | announcement | statement, compare, divider, letter, signoff |
| 08 | outreach.partner | b2b | letter, signature |
| 09 | internal.ops_update | internal | statement, table, notice, signoff |
Each preview below is the real render. Switch it between 600 and 375 px, light and dark, or show the text part and the template source.
01 · A buyer's order on its way. The service footer, with the frontmatter note in place of the default.
Your produce box is on its way
From: Loam <orders@loam.example>
02 · A grower's payout. A figure hero, then a breakdown straight under it.
Payout sent: $1,019.90
From: Loam Growers <growers@loam.example>
03 · A password reset. The security profile has no service line.
Your Loam reset code
From: Loam Security <security@loam.example>
04 · The Field Notes newsletter. Frontmatter issue adds the masthead, and the marketing footer has the nav row.
Forty trees after the frost
From: Field Notes <notes@loam.example>
05 · A campaign. Products bound from data, and an offer code.
Harvest Week: 48 hours of the valley's best
From: Loam <hello@loam.example>
06 · A courier's job offer. The map band renders its ground when map_url is empty.
New job: Millbrook to Fernhill · $6
From: Loam Couriers <couriers@loam.example>
07 · A fee change. An announcement: the marketing footer without the nav row, and a reason from the frontmatter.
Lower commission on farm workshops from 1 November
From: Loam <hello@loam.example>
08 · Partner outreach. The b2b profile has no fixed sender, so the template sets from: on the partners subdomain. The outreach footer ends with the opt-out line.
Seasonal produce for Hearth
From: Nadia Brennan <nadia@partners.loam.example>
09 · An internal update. The internal profile adds the banner and the internal footer.
Q4 courier onboarding schedule
From: Loam Ops <team@loam.example>
Restyle it
Quiet's vars are yours to set, but its tokens are fixed: Config has no way to override a colour or a font. To change them, take a copy. The kits/quiet package imports only the standard library and lttr/kit, so copy the whole directory, Go files included, into your module, rename the package and edit kit.yaml. Its template functions are unexported, so a copy of the kit files alone, without the Go package, doesn't load.
For a design of your own, start from Plain instead: Build your own kit walks through it.
Build your own kit
Start from Plain with lttr kit init, change its tokens, add a component that binds a Go type, write a template for it and test the lot from Go.
Migrating from v0.1
What v0.2.0 removed and renamed, what replaces families, themes, streams and placeholders, and a v0.1 program ported step by step.