Skip to content

Type to search the docs, API, and blog.

↑↓ navigate↵ openesc close
  • Zazz 0.16 alpha

    API

    Typography roles

    Named text presets that bundle family, size, weight, leading, tracking, and case.

    Native h1–h6 carry their role by default. Any other element takes one with data-font: data-font="h4", data-ui="badge" data-font="xs". A role beats the font of the primitive it sits on, and a utility overrides one property of it (--font-size, --leading, --font-weight); never rebuild a role from utilities. The font page lists the attribute.

    data-font="display"The quick brown fox
    data-font="h1"The quick brown fox
    data-font="h2"The quick brown fox
    data-font="h3"The quick brown fox
    data-font="h4"The quick brown fox
    data-font="h5"The quick brown fox
    data-font="h6"The quick brown fox
    data-font="eyebrow"The quick brown fox
    data-font="2xl"The quick brown fox
    data-font="xl"The quick brown fox
    data-font="lg"The quick brown fox
    data-font="md"The quick brown fox
    data-font="sm"The quick brown fox
    data-font="xs"The quick brown fox
    data-font="2xs"The quick brown fox

    Sizes

    The body sizes 2xs to 2xl are the --font-size-* tokens with matching leading and tracking. Every size comes from a fluid type scale: a base size and a scale ratio, each growing between a small-screen and a large-screen value, with per-step multipliers below the base. Tune those controls (on the tokens page), not the sizes. eyebrow is a small label: uppercase, tracked, and muted by convention. display is the one size above h1, for a hero headline.

    Letter spacing and line height

    A typeface with wide or tight default spacing needs every role adjusted by the same amount. Do it with one token instead of thirteen. --tracking-modifier is a length added to every --tracking-* token. --tracking-heading-modifier covers display and h1–h6, and --tracking-body-modifier covers 2xl–2xs and the eyebrow. Both default to --tracking-modifier, so set the global one and override a group only when it needs something different. Give each a unit (0.01em). A bare 0 would break the calc() behind the tokens.

    Line height works the same way with coefficients. --leading-heading-coefficient and --leading-body-coefficient (both 1 by default) scale every --leading-* token in their group.

    :root {
      --tracking-modifier: -0.01em;
      --leading-body-coefficient: 1.05;
    }

    Links inside prose are underlined for you. Anywhere else, an inline link takes the link identity: <a href="/docs/" data-ui="link">. It underlines in the text's own color at the --decoration-thickness and --decoration-offset tokens and fades the underline on hover. Add a role for its size (data-ui="link" data-font="sm"). A link that acts like a control is a button with the link variant.

    Rich text

    data-ui="prose" styles the content inside it: paragraph rhythm, lists, figures, blockquotes, headings. Give it a reading measure with --max-w: var(--article-lg); --mx: auto. data-prose-size="sm" and "lg" resize one article, and --ui-prose-flow loosens or tightens its spacing; both are on the prose page with its hooks.

    API