Define your theme tokens
You have a palette, a type scale and a spacing rhythm to set up, and you are looking for the config file that does not exist.
Goal
Turn your design system into utilities your sections can use, by declaring
Tailwind v4 @theme tokens in the stylesheet entry.
There is no theme object and no configuration file. A token is a CSS custom property in one block, and Tailwind compiles a utility for it.
Prerequisites
The workspace from Start. Styling says why the design system is CSS rather than configuration, and why author CSS is unlayered — both matter the first time a token of yours has to beat a utility.
Steps
1. Declare the tokens in globals.css
The entry is the first stylesheet template.ts imports, and it is the one file
in the graph that imports Tailwind. @theme goes after both imports.
@import "tailwindcss";
@import "@homepages/concrete/styles.css";
@theme {
--color-ink: #171717;
--color-paper: #faf8f4;
--color-accent: #8a5b2a;
--font-display: "Canela", Georgia, serif;
--font-body: ui-sans-serif, system-ui, sans-serif;
--text-hero: 4.5rem;
--spacing: 0.25rem;
}The namespace before the second dash is what decides the utilities. --color-ink
yields text-ink, bg-ink, border-ink and the rest of the colour family;
--font-display yields font-display; --text-hero yields text-hero.
Two @import "tailwindcss" lines in the graph, or none, is
css/tailwind-import.
2. Use them as ordinary utilities
Nothing registers a token and nothing imports it. A section written against
bg-paper compiles because the entry declared the token, and the compiled
stylesheet carries only the utilities your markup actually used.
import { fact, fill, Section, section, Slot, text } from "@homepages/concrete";
const BRIEF = fill.write({
reads: [fact.property.description],
brief: "Name what makes the property worth seeing. Write one sentence. Confident and short.",
});
export const Hero = section(
{ key: "hero", label: "Hero", slots: { headline: text.medium({ label: "Headline", cap: 80, source: BRIEF }) } },
({ slot }) => (
<Section className="bg-paper text-ink">
<Slot.Text slot={slot.headline} as="h1" className="font-display text-hero" />
</Section>
),
);A hex value written into a class or an inline style instead is
style/no-hard-coded-color — a warning your
editor shows and concrete check never fails on, because the fix is a token and
a token is a decision.
3. Swap the breakpoints, if yours are not Tailwind's
The framework declares none and resets none, so Tailwind's own defaults reach you
untouched. --breakpoint-* tokens replace them:
@theme {
--breakpoint-sm: 30rem;
--breakpoint-lg: 72rem;
}Write an arbitrary one-off breakpoint in rem units too — a pixel value in a
min-[…]: or max-[…]: variant is
style/no-px-breakpoint, because a reader who
has scaled their text gets a layout that switches at the wrong size.
4. Redeclare a token locally when a section needs a different one
Author CSS is assigned no cascade layer, so a :root block in a section's own
stylesheet now takes effect against the entry's:
.hero-dark {
--color-ink: #f5f5f5;
}Verify
Run concrete dev and read the compiled result in the playground — a token that
never reached a utility shows up as an element with no styling at all rather than
as an error. Then run concrete check: the stylesheet stage compiles the whole
graph, and a token block that cannot compile is
css/compile-failed naming the file.
Follow another section's value
Two sections have to agree — a footer echoing the hero, a gate printing the property's name — so one slot mirrors or derives from the other.
Ship a font with the template
Your design uses a licensed or self-hosted typeface, and you need it in the template rather than on a font CDN.
