Theming

Set a shared token once and every block that reads it follows. Each block also has tokens of its own, for when one needs to differ.

Shared tokens

Put them on :root, or on any element to theme just what is inside it. A block reads them through its own tokens, so setting a block's token still wins.

CSS
:root {
  --airflib-radius: 20px;
  --airflib-surface: #f4f2ee;
  --airflib-text: #1b1a17;
  --airflib-font: "Inter", system-ui, sans-serif;
}
  • --airflib-radius: corner radius of the main surface.
  • --airflib-surface: what the block sits on: the stage colour behind it.
  • --airflib-surface-raised: the block's own plate, raised above the surface.
  • --airflib-text: main text and ink.
  • --airflib-text-muted: secondary text.
  • --airflib-line: hairlines and borders.
  • --airflib-accent: the highlight colour.
  • --airflib-font: font family.
  • --airflib-ease-soft: the soft motion curve.
  • --airflib-duration-fast: a short motion length.
  • --airflib-duration-medium: a medium motion length.

One block's own tokens

Every block lists its tokens in its Copy prompt, with their defaults. Set them through the block's style, or in your stylesheet with a selector more specific than the block's root class:

TSX
import { CardBrowse } from "@/components/airflib/components/card-browse";

export function Deck() {
  return <CardBrowse style={{ "--card-browse-radius": "28px" }} />;
}

Light and dark

Blocks that have a light and a dark look take a tone option. Follow your own theme switch with it.