matter.work
Building Apps / Runtime & Shipping

Look and feel

Style your app with --matter-* CSS variables so it matches light, dark, and wallpaper modes.

Matter injects its active theme into every app page as --matter-* CSS custom properties on :root, and updates them live whenever the member switches between light and dark mode. It also sets color-scheme: light or dark automatically. Style your elements with these variables and your app will look and feel like a native part of Matter.

The starter that matter app create makes already does this for you. Its Tailwind theme (src/matter.css) maps Tailwind’s colors, radii and fonts onto these variables, so bg-card, text-muted-foreground and border-border mean what they do in Matter. Its components are built on the same theme.

The Page and Its Surfaces#

1. Transparent Page

--matter-background is transparent so the window's native vibrancy material shows through behind your app—never paint an opaque body background.

2. Translucent Cards

--matter-card (paired with --matter-card-foreground) gives panels and cards a subtle translucent fill that layers cleanly over the window.

3. Opaque Popovers

--matter-popover (and --matter-popover-foreground) is opaque. Use it for dropdown menus, modals, and toasts that sit above content.

Detail Beside the List#

Matter shows an item beside the list it came from: a task beside its board, a thread beside its task. Do the same. Keep the list or board on the page and open an item's detail with matter.panels.open, not in a modal or an expanding row. Keep modals for short questions, like confirming a delete.

The Variables#

Group CSS Custom Properties
Text --matter-foreground, --matter-muted-foreground, --matter-faint
Surfaces --matter-background, --matter-card, --matter-card-foreground, --matter-popover, --matter-popover-foreground, --matter-muted, --matter-secondary, --matter-secondary-foreground
Accents --matter-primary, --matter-primary-text, --matter-primary-foreground
States --matter-hover, --matter-selected, --matter-selection, --matter-ring
Borders & Inputs --matter-border, --matter-border-light, --matter-input
Status --matter-destructive, --matter-destructive-foreground, --matter-warning, --matter-success
Radii --matter-radius-sm, --matter-radius-md, --matter-radius-lg, --matter-radius-xl
Typography --matter-font-sans, --matter-font-mono, --matter-font-size

Use --matter-primary as a solid button or badge fill with --matter-primary-foreground for its label. Use --matter-primary-text when coloring links or accent text directly on a card or page background.

Status Tints#

Use color-mix() with the semantic status tokens to create soft pill backgrounds that adapt cleanly to both light and dark mode:

CSS
.badge-won {
  color: var(--matter-success);
  background: color-mix(in srgb, var(--matter-success) 14%, transparent);
}

Option Colors#

Select options and board statuses have a color in Matter’s palette. A field’s options and a board’s statuses carry it as a name (red, blue, and so on), and each name has a variable: --matter-palette-gray, -brown, -red, -orange, -yellow, -green, -teal, -blue, -indigo, -purple and -pink. Matter draws an option as text in its color, over a wash of it, inside an edge of it, with --matter-palette-wash and --matter-palette-edge as their strengths. Treat an unknown name as gray. Since Matter 0.5.27.

An option as Matter draws it
const field = (await matter.table('deals').fields()).find((f) => f.key === 'stage')
const option = field.options.find((o) => o.key === deal.values.stage)
const color = `var(--matter-palette-${option?.color ?? 'gray'})`
chip.style.color = color
chip.style.background = `color-mix(in oklab, ${color} var(--matter-palette-wash), transparent)`
chip.style.border = `1px solid color-mix(in oklab, ${color} var(--matter-palette-edge), transparent)`

With the starter’s Tailwind theme, the same colors are text-palette-red, bg-palette-red/10 and the rest.

Avatars#

<matter-avatar> shows a member as Matter does: their photo, or a chip with their initial, tinted by their name. Every page has it, with nothing to import. Give it a member’s id, and it finds their name and photo:

A task’s owner
row.innerHTML = `<matter-avatar member="${task.owner.id}" size="18"></matter-avatar> ${task.title}`
  • member: a member’s id, from matter.members(), matter.user.memberId or a person value.
  • size: its width and height in pixels. 18 if not given.
  • shape: circle (the default) or squircle, which Matter uses for apps and agents.
  • name and src: draw someone who isn’t a member, or a photo of your own.
  • no-hint: no tooltip. Hovered, an avatar shows the person’s name, as Matter’s do; leave it out where the name shows beside it.

In a React app, the Avatar component draws it and declares the element for TypeScript.

Keeping Clear of Matter’s Mark#

Matter’s mark floats in the window’s bottom-right corner. Where it would sit on something your page needs there, mark that with data-matter-keep-clear, and the mark tucks into the window’s right edge out of its way, as it does for Matter’s own composers. Use it for a composer or a row of actions at the foot of a pane. Since Matter 0.5.9; older versions ignore it.

A composer at a pane's foot
<form class="ask" data-matter-keep-clear>
  <input placeholder="Ask for a change…" /> <button>Send</button>
</form>

Only what reaches into the lower half of the window moves it, and it comes back once the marked part scrolls away or goes.

Showing the Page#

Matter shows your page once it has what it first shows. Until then it keeps the page out of sight, and if that takes more than a moment it shows its own loading mark in its place, as it does for its own pages. Without anything from you, a page shows when it loads. A page that fetches its content first should hold the reveal until that’s in, so it never shows half drawn:

Showing once the deals are in
const shown = matter.page.hold()
const deals = await matter.table('Deals').query({ index: 'by_stage', eq: { Stage: 'Open' } })
render(deals)
shown()

Call hold() as the page starts. A page held for more than 5 seconds shows as it is. The same goes for every panel and tab: each is a page of its own.

The Entrance#

As a page shows, its parts can rise into place one after another, as Matter’s own pages do. Mark them, and Matter does the rest, with its own timing:

Parts that enter
<header data-enter>…</header>
<ul data-enter-each="li">
  <li>Acme</li>
  <li>Globex</li>
</ul>
  • data-enter marks a part. A part waits for the parts above it and to its left, so a column enters top to bottom and a grid sweeps in from its top left corner. A part inside another takes its turn once that one rises.
  • data-enter-each="selector" marks every element the selector matches inside it: a list’s rows, a board’s cards.
  • data-enter-zone makes a region enter on its own, not waiting for the rest of the page.
  • data-enter-unhurried slows a region meant to be taken in, as Matter does on Home.
  • Parts scrolled out of view are simply there. Nothing rises when the member has asked for reduced motion.

The entrance plays when the page first shows in its place, and again each time a tab comes back into view. After a client-side navigation, play it for what’s new with matter.page.enter(element).

Fallbacks#

Matter injects its variables via a user-origin stylesheet, so any fallback values help when previewing your UI in a standalone browser or test runner:

CSS
:root {
  font-family: var(--matter-font-sans, system-ui, sans-serif);
  font-size: var(--matter-font-size, 14px);
  color: var(--matter-foreground, #202124);
  background: var(--matter-background, transparent);
}

.card {
  background: var(--matter-card, rgb(255 255 255 / 70%));
  border: 1px solid var(--matter-border, rgb(0 0 0 / 10%));
  border-radius: var(--matter-radius-lg, 10px);
}

.menu {
  background: var(--matter-popover, #fff);
  color: var(--matter-popover-foreground, #202124);
}