Design guide
Make your view look like it belongs on the island.
Your view is drawn by Adanotch with the same colours, type and spacing as the built-in modules. You don't style anything; you choose meaning: a tone, a text style, one primary button. This page is about choosing well.
Use a tone, not a colour
A tone is a meaning. Adanotch picks the shade, so your view follows the island if its colours change.
Temel metin ve simgeler
ÖrnekYardımcı metin ve etiketler
ÖrnekVurgu, bağlantı, sayaç
ÖrnekTamamlanan, onaylanan
ÖrnekUyarı, bekleyen durum
ÖrnekKritik sınır, hata
Örnek| Tone | Say it when |
|---|---|
default | Normal content. Leave it out. |
secondary | Supporting text: units, timestamps, hints. |
accent | The one thing to look at. |
success | Done, connected, healthy. |
warning | Needs attention soon. |
danger | Failed, or about to lose something. |
Pick a tone for what it means, not for how it looks. Someone who can't tell the colours apart still reads the word next to it.
ui.stack([
ui.text("Disk"),
ui.badge("92% full", { tone: "warning" }),
]);The only colour you choose yourself is a swatch, for data that has its own colour (a tag, a team). It takes #RGB or #RRGGBB.
Text styles
| Style | Use for |
|---|---|
display | The one big figure of a view: a clock, a temperature. |
title | The main line of the card. |
body | Default. Leave it out. |
caption | Metadata, timestamps, hints. |
mono | Code, ids, output. |
One display per view. If everything is big, nothing is.
ui.stack([
ui.text("21°", { style: "display" }),
ui.text("Clear · updated 3 min ago", { style: "caption", tone: "secondary" }),
]);Badges
A short status or count beside a title: one or two words. A badge isn't tappable; use a button for that.
ui.badge("Connected", { tone: "success" });
ui.badge("Recording", { tone: "danger", live: true }); // a pulsing dot: happening right now
ui.badge("New", { tone: "accent", filled: true }); // one badge that should stand outdot adds a small dot, live makes it pulse, icon adds an SF Symbol, and filled fills it with the tone and dark text. Use live only while something is actually happening, and filled once per view. A sentence is not a badge. Put it in ui.text.
Buttons
primary marks the one main action of a view. Everything else is quieter. Two primaries compete, and the user can't tell which one is the default.
On the island the primary button is a cream pill with dark text. Cream is the island's colour for "on": the active tab, a switched-on toggle and the chosen segment use it too, so one primary stands out at a glance. The other buttons are pills as well: secondary on a faint white ground, outline and ghost in indigo text.
variant | Use for |
|---|---|
primary | The one main action. Same as primary: true. |
secondary | The default: a second action beside the primary. |
outline | A neutral action that shouldn't compete. |
ghost | A quiet action in a row or toolbar. |
tinted | A soft emphasis, e.g. a state that is on. |
destructive | Delete, reset, disconnect. Ask first. |
size: "small" is for buttons inside a row or an alert.
ui.stack([
ui.button("Cancel", "cancel"),
ui.button("Save", "save", { primary: true }),
], { axis: "h" });Alerts
An alert is a message that belongs to the whole view: a module is off, a permission is missing, a sync failed. One title, at most one sentence, and at most one button.
ui.alert("Permission needed", {
message: "Shortcuts don't work without Accessibility access.",
tone: "danger",
variant: "tinted",
button: { label: "Open", action: "open-settings" },
});
ui.alert("Synced just now", { tone: "success", variant: "ghost" });tinted is the loudest, border the default, ghost the quietest. Use success, warning and danger for status; anything else reads as plain information. Don't use an alert for a value that changes every second: that's a ui.text or a badge.
Cards
A card groups related content on its own ground. Put the things that belong together in one card, and use a stack for the rest of the view.
ui.card(
[ui.text("Today", { style: "title" }), ui.text("3 events", { style: "caption", tone: "secondary" })],
{ action: "open-today" }, // the whole card is a button
);
ui.card(
[ui.text("Go further", { style: "title" }), ui.text("One highlighted card per view", { style: "caption" })],
{ variant: "brand" },
);On the island a card is a dark ground with 22 pt corners and a hairline edge; brand is an indigo gradient and selected keeps the ground and draws a cream edge.
bordered is the default. Use brand for one card at most, tinted for something that has its own colour, and selected for the chosen card in a set. Don't nest a card inside a card.
Icon badges
ui.iconBadge puts a symbol on a tile: the leading mark of a row or a card. Use it instead of a bare ui.icon when the symbol should read as an object.
ui.iconBadge("bolt.fill", { tone: "accent", variant: "solid", size: "lg", round: true });
ui.iconBadge("bolt.fill", { tone: "success" }); // tinted, md
ui.iconBadge("bolt.fill", { tone: "warning", variant: "border", size: "sm" });Tabs, segments and fields
ui.tabs(tabs, { style: "underline" })for views of the same content,"container"(the default) for a cream pill on a grey track.ui.picker(action, value, options, { style: "segmented" })when two to four short options should all be visible; the default is a drop-down.ui.textField(action, { icon, hint, invalid }):iconsays what the field is for,hintis a unit or a shortcut at the end, andinvaliddraws the edge in the danger colour. Say why it is invalid in aui.textwithtone: "danger"beside it.
Compact and expanded
The compact slot is the closed island: an icon, a short text, a badge, a timer or a gauge on each side of the notch. Keep each side to one small thing. Put detail in expanded.
- Show the number that matters in
compact(ui.text("21°")), the story inexpanded. - Don't repeat the same text on both sides of the notch.
- A
gaugeorprogressis a good compact node: it reads at a glance.
Icons
Use SF Symbols, never an image, for anything that isn't a picture of something: ui.icon("cloud.sun.fill"). They follow the text weight and the tone. Use ui.image only for a real picture (an avatar, a logo), and only from your network: hosts.
Before you ship
- Every colour is a tone (or a
swatch). - One
display, at most. - One
primarybutton per view, and onefilledbadge at most. - Badges are one or two words.
-
compactholds one small thing per side (alert,cardandiconBadgecan't go there). - Looks right with an empty state: no data yet, no network.
alert, card and iconBadge, and the new options on the other helpers, came with @adanotch/kit 0.2.0. Set adanotchVersion in your manifest to the Adanotch release that ships it before you use them.
See UI nodes for every helper and its options.