Tokens & Tailwind classes
The merchant's brand identity — their primary color, surface color, button radius, heading font — lives in tokens. Tokens are stored on the theme document at config.tokens, emitted as CSS variables on :root, and bound to a curated set of Tailwind classes.
As a section author, you use the Tailwind classes. The merchant's edits flow through automatically.
How it works
- Storage.
theme.config.tokensis a flat object:{ primary: "#222", accent: "#d4af37", fontHeading: "Playfair Display", radiusLg: "16px", ... }. - Emit.
plugins/theme-vars.client.tswatches that object and writes a<style>block on:rootlike:css:root { --token-primary: #222; --token-accent: #d4af37; --token-fontHeading: "Playfair Display", system-ui, sans-serif; --token-radiusLg: 16px; /* ... */ } - Bind.
tailwind.config.jsmaps utility classes to those vars with a hard-coded fallback:jscolors: { accent: 'var(--token-accent, #d4af37)', } - Use. Your section writes
class="bg-accent". When the merchant changes their accent color, everybg-accentelement on the storefront re-paints.
You don't need to read tokens directly. Use the Tailwind classes — the indirection is transparent.
Color tokens
| Tailwind class | Token variable | Default | Use for |
|---|---|---|---|
bg-primary / text-primary / border-primary | --token-primary | #1a1a1a | Primary brand color. Filled buttons, brand accents. |
bg-secondary / text-secondary / border-secondary | --token-secondary | #fafafa | Soft secondary surface — cards on top of surface. |
bg-accent / text-accent / border-accent | --token-accent | #d4af37 | The merchant's spotlight color. Sale badges, CTA hover, decorative highlights. |
bg-surface / text-surface | --token-surface | #ffffff | The page background. White or near-white. Use for cards, inputs, modals. |
bg-third / border-third | --token-third | #e5e3df | Neutral borders, dividers, faint backgrounds. Between surface and muted in luminance. |
text-ink | --token-text | #2f2b3d | Body text color. Use as the default text color everywhere. |
text-muted | --token-muted | #6f6b7d | Secondary text — captions, helper text, breadcrumbs. |
Rule of thumb: never use Tailwind's stock color classes (
text-gray-700,bg-zinc-100, ...) unless you genuinely don't want merchant control. Stock colors won't re-paint when the merchant changes their brand.
Border-radius tokens
| Tailwind class | Token variable | Default | Use for |
|---|---|---|---|
rounded-sm / rounded-token-sm | --token-radiusSm | 4px | Inputs, small chips. |
rounded-md / rounded-token-md | --token-radiusMd | 8px | Standard cards, modals. |
rounded-lg / rounded-token-lg | --token-radiusLg | 16px | Hero images, large feature cards. |
rounded-token-button | --token-radiusButton | 8px | Buttons. Use specifically on button elements so merchants can dial button shape separately from card shape. |
rounded (Tailwind default 0.25rem) and rounded-full (9999px) are not token-driven on purpose — they're for chips and circular icons where merchant control would be confusing.
Font tokens
The theme exposes two font tokens. These are bound directly via CSS, not Tailwind class shortcuts:
| CSS class to use | Token variable | Default | Use for |
|---|---|---|---|
font-heading (via custom class) | --token-fontHeading | system-ui | Headings (<h1>–<h6>). |
font-body (default <body> font) | --token-fontBody | system-ui | Body text. |
In practice you rarely need to set the heading font explicitly — <h1>–<h6> already inherit --token-fontHeading via the global stylesheet in assets/main.css. Just use semantic heading tags and the merchant's font flows through.
If you do need to force a specific token:
<p :style="{ fontFamily: 'var(--token-fontHeading)' }">Stylized line</p>But this is an escape hatch — the global rules cover 95% of cases.
Size + spacing tokens
| Token variable | Default | Use |
|---|---|---|
--token-fontSizeBase | 15px | Drives html { font-size: ... } — every rem value scales. Merchants pick a base size; the whole storefront scales with it. |
--token-containerWidth | 1280px | Max width of .container. Tailwind's container class already reads it via assets/main.css. |
--token-sectionSpacing | 1 | Multiplier (not a px value). Drives padding-block on every section. 2 = double the vertical rhythm. Apply automatically; you don't think about it per section. |
Putting it together
A typical section root:
<section class="bg-surface text-ink">
<div class="container mx-auto px-4">
<h2 class="font-semibold text-2xl md:text-3xl">{{ title }}</h2>
<p class="text-muted mt-2">{{ subtitle }}</p>
<button class="bg-primary text-surface rounded-token-button px-6 py-3 hover:bg-accent">
{{ ctaLabel }}
</button>
</div>
</section>Every color, radius, and the container width respond to the merchant's token edits. Heading font is inherited via <h2>. No useStyles needed for the basics — those are reserved for named element scopes the merchant can override per-section.
When tokens aren't enough
Sometimes the merchant wants per-section control: "this banner only, change the title to gold." That's what styleKeys + useStyles are for (see Writing the component and Composables reference). The hierarchy:
- Tokens = whole-storefront defaults. Edited in the theme Settings.
useStylesslots = per-section overrides. Edited in the inspector's Style panel.
Tokens render first; section-level styles override them. The merchant has both knobs.
Common mistakes
- Using Tailwind stock colors (
text-gray-700,bg-zinc-100). Won't re-paint on token change. Replace withtext-ink,text-muted,bg-surface,bg-secondary. - Hard-coding hex colors (
style="color: #222"). Same problem. Use a token class. - Using
rounded-xlorrounded-2xl— Tailwind's stock radii. Userounded-lg(which we redefined to--token-radiusLg) instead. - Setting font-family inline. Trust the global stylesheet; semantic tags already use the right token.
Reference: the full token list
Pulled from theme-vars.client.ts. Anything in config.tokens lands as --token-<key> on :root.
--token-primary
--token-secondary
--token-accent
--token-third
--token-surface
--token-text
--token-muted
--token-fontHeading
--token-fontBody
--token-fontSizeBase
--token-radiusSm
--token-radiusMd
--token-radiusLg
--token-radiusButton
--token-containerWidth
--token-sectionSpacingIf a merchant sets a custom token (config.tokens.brandShadow: "0 8px 30px rgba(...)"), it lands as --token-brandShadow automatically. You can read it via inline style or by extending tailwind.config.js.