Repository navigation
Design and Frontend Guidelines
Use this page when you change how the Tribu web app looks or behaves on screen. It describes the design tokens, themes, layout rules, accessibility expectations, and which source files own each part of the interface. For module boundaries and runtime flows, see Architecture. For the contributor workflow, see Contributing.
Tribu should feel like a calm home base for a family, not an admin console.
- The day before the area. People come to Tribu to see what is on, what is missing, and who takes care of it. Put that content first.
- Content before controls. Show events, tasks, and items first. Filters, pickers, imports, and settings appear on demand.
- People carry the colour. Family members are the strongest orientation in a family app. Status colours stay semantic, and areas use neutral icons.
- One accent per screen. The accent marks the primary action, the active navigation, focus, and selection. Do not use it as decoration.
- Calm by default. No technical states, raw errors, IDs, URLs, or token values in family-facing views. Prefer undo where an action is reversible.
- Reuse before inventing. Match an existing header, sheet, row, chip, or card pattern before adding a new one.
frontend/design/tokens.json is the single source for colours, shadows, type, spacing, radii, and motion. npm run tokens:generate (from frontend) writes frontend/styles/tokens.css and the backend's copy of the theme list, backend/app/ui_themes.json; never edit either file by hand. npm run tokens:check fails when one of them is stale, and the design token unit test checks the same thing.
| Group | CSS variables | Notes |
|---|---|---|
| Colour roles |
--color-* (for example --color-text, --color-surface, --color-accent) |
One set per theme; every theme must define the same roles in the same order |
| Shadows |
--shadow-sm, --shadow-md, --shadow-lg
|
Per theme |
| Member palette |
--member-1 to --member-8
|
Fallback colours for people without a profile colour |
| Type |
--type-<style>-size, -line, -weight, -tracking
|
Styles from display to label; nothing below 13 px |
| Space |
--space-1 to --space-12
|
4-point steps: 4, 8, 12, 16, 24, 32, 48 px |
| Radius |
--radius-control, --radius-card, --radius-sheet, --radius-pill
|
Controls, cards, sheets, chips |
| Motion |
--motion-fast, --motion-standard, --motion-enter
|
Durations in milliseconds |
The generator rejects invalid input: colours must be #RRGGBB or rgba(r, g, b, a), each theme needs all shadow sizes, the member palette needs at least eight colours, and every type style needs a family, size, line height, and weight.
When you add or change a colour role, keep text readable. The unit test requires WCAG AA contrast (4.5:1) for the text, muted text, accent, and status roles on their surfaces in every theme. If a new pairing matters, add it to that test.
Other clients may generate their own tokens from a copy of tokens.json. Treat renaming or removing a role as a breaking change and mention it in the PR.
- New styles use the token variables directly, for example
var(--color-surface),var(--space-4), andvar(--radius-card). -
frontend/styles/globals.cssstill defines older variable names such as--text-primaryor--amethyst. They point at token roles so existing views follow the themes. Do not add new names of this kind. - Do not hard-code colours in components or stylesheets. If no role fits, propose a new role in
tokens.json.
Tribu ships ten themes, most of them in light and dark pairs:
| Light | Dark |
|---|---|
| Morning Mist | Dark |
| Garden | Garden Night |
| Harbour | Harbour Night |
| Hearth Day | Hearth |
| High Contrast | – |
| – | Midnight Glass |
A new device follows its system setting (Match device under Settings → This device → Appearance), within the pair picked last (Morning Mist and Dark until one is). The dark-mode switch in the account menu moves between the two themes of a pair. Theme names are not translated.
The themes in tokens.json are the whole theme list. Each entry has a name, an optional description, its colorScheme (light or dark), an optional partner (its counterpart in the other scheme), and the colour roles. Settings, the setup wizard, the pre-paint script and the backend all read this list, so a new theme is one more entry plus npm run tokens:generate. The generator checks that keys are lower-case letters, digits and dashes, and that every partner exists and uses the other scheme.
The app sets data-theme to the theme key and data-scheme to its colour scheme. Use [data-scheme="dark"] or [data-scheme="light"] for styles meant for any dark or any light theme, and [data-theme="…"] only for touches of one theme, such as the glass effects of Midnight Glass. Without a data-theme attribute, the generated CSS falls back to the Midnight Glass values.
Fonts are defined in globals.css:
-
Inter for the interface (
--font-ui) -
Fraunces for display moments such as greetings (
--font-display) -
JetBrains Mono only for compact technical details (
--font-mono), never for names, titles, or family content
The app is organised into four areas: Today, Plan, Lists, and Family. frontend/lib/navigation.js defines the areas, their pages, and which pages are adult-only or hidden in the demo. Add a new page to an existing area there instead of creating a new top-level entry. See Today and Navigation for what users see.
- Phone shell: at 768 px and below, the app uses the bottom tab bar with + in the middle and shows the pages of an area as chips below the header. Wider screens show the sidebar.
- Planner views (calendar, meal plan, week at a glance) measure their own content width and switch to a compact layout below 800 px. A tablet with an open sidebar can therefore use the compact planner while the shell stays in desktop mode.
- Today shows the week ahead beside the timeline from 1100 px.
- Sheets and dialogs use the shared bottom sheet on phones and keep their actions reachable when the on-screen keyboard is open.
- Pages that need the whole screen, such as shopping mode, hide the shared navigation on purpose.
Layout rules:
- Keep the first screen focused on concrete family actions. Signed-in views have no hero areas or marketing-sized headings.
- Align cards to the top and keep a compact rhythm. Empty space must not push the next action below the fold.
- Navigation surfaces, sheets, and overlays must stay opaque enough to read in every theme, including an installed PWA.
- The shared display (
/display) is not an app page. It has no app shell, account, or settings, and shows only display-safe information. See Shared Home Display.
- Contrast: use token roles that pass the contrast test; do not lower contrast with transparency on text.
-
Focus: every interactive element shows a visible focus ring. Do not remove
:focus-visiblestyles. - Touch targets: buttons, rows, and inputs are at least 44 px high (and wide for icon buttons).
- Not colour alone: status, ownership, and selection also need a label, icon, or shape.
- Semantics: use real buttons, links, headings, and labels. Dialogs trap focus, close with Escape, and return focus to where they opened.
-
Motion: keep transitions short, never shift layout on hover, and honour
prefers-reduced-motion. E-ink displays use no animation at all. - Text scaling: layouts must keep working when the browser text size is increased.
| Part | Source |
|---|---|
| Tokens and generated CSS |
frontend/design/tokens.json, frontend/scripts/generate-design-tokens.js, frontend/styles/tokens.css
|
| Global styles, fonts, older variable names | frontend/styles/globals.css |
| Theme list |
frontend/design/tokens.json, read by frontend/lib/themes.js
|
| Navigation areas | frontend/lib/navigation.js |
| Header, area chips, account menu |
frontend/components/shell/, frontend/styles/shell.css
|
| Phone sheets, + forms, planner layout |
frontend/components/responsive/, frontend/hooks/useResponsiveUI.js, frontend/styles/responsive.css
|
| Today, capture, tasks, shopping, family hub |
frontend/styles/today.css, capture.css, tasks.css, shopping.css, family.css
|
| Calendar, rewards, gifts, settings |
frontend/styles/calendar.css, rewards.css, gifts.css, settings.css
|
| Manage your family |
frontend/components/admin/, frontend/styles/admin.css
|
| Shared display |
frontend/components/display/, frontend/styles/display.css
|
| Translations |
frontend/i18n/*.json (see CONTRIBUTING.md) |
Data loading and mutations stay in the hooks and API clients that own them. Changing a layout must not add a second data source or reset an open form.
Do not start class names with ad- or ads-. Common ad-blocker lists hide such elements on every site, which once emptied the admin page. A unit test (AdBlockerSafeClasses) guards this; the admin styles use the fam- prefix instead.
- Labels say what the family can do next, for example Add task or Start shopping, rather than Manage or Configure.
- Empty states use one sentence and one action.
- New user-facing text goes into
frontend/i18n/en.jsonfirst, and the same key must exist in every language bundle. - Screenshots for docs and pull requests come from the current app with synthetic family data. Remove or replace screenshots when the interface they show changes.
- Colours, spacing, radii, and type come from tokens; no new hard-coded colours
-
tokens.cssregenerated iftokens.jsonchanged, and the contrast test passes - Works at phone width (320 to 768 px), tablet, and desktop, in light and dark themes
- Visible focus, 44 px targets, labels, and reduced motion respected
- No technical IDs, raw errors, URLs, or tokens in family-facing views
- Screenshots added for meaningful visual changes