@bwui/tailwind
Brickwork Tailwind presets, generated from @bwui/tokens. Expose Brickwork
semantic roles as Tailwind utilities (bg-surface, text-fg, border-border,
rounded-md, shadow-1, font-sans, ...). Colours resolve through the token
layer, so light/dark switching keeps working via the data-theme attribute.
Tailwind v4 (CSS-first)
@import "tailwindcss";
@import "@bwui/tokens/tokens.css"; /* defines --bw-* runtime vars */
@import "@bwui/tailwind/theme.css"; /* maps them to Tailwind namespaces */
Then use utilities directly:
<div class="bg-surface text-fg border border-border rounded-lg shadow-1 p-4">
<span class="text-accent font-sans">Brickwork</span>
</div>
Theming: Dark mode uses the data-theme="dark" attribute, not the .dark
class (Tailwind's default). The shell sets this attribute on <html>. If
your framework toggles .dark instead, bridge the signal onto
data-theme="dark" on <html>.
Tailwind v3 (JS preset)
// tailwind.config.js
import brickwork from "@bwui/tailwind/preset"
export default {
presets: [brickwork],
content: ["./src/**/*.{html,js,ts,jsx,tsx}"],
}
Note: The v3 preset extends the v3 Tailwind hex palette, which differs
from the v4 oklch stock palette (ADR-128). To use the Brickwork default
palette in a v3 project, import @bwui/tokens/palette.css separately and
reference --bw-palette-<hue>-<stop> custom properties.
Both artefacts are regenerated by the @bwui/tokens build; do not edit
preset.mjs or theme.css by hand.
Tailwind-first recipe (layout utilities + kit chrome)
The umbrella docs/specs/brickwork/DELIVERY.md defines the Tailwind-first
idiom as utilities for layout; kit classes for chrome. Do not restyle
buttons, cards or fields with utility colours when a bw-* class already owns
that look.
- Import tokens and the Tailwind projection (v4 sketch above, or the v3
preset).
- Also load
@bwui/css when you use bw-* components.
- Use Tailwind for page structure only:
flex, grid, gap-*, max-w-*,
px-*, py-*, min-h-svh.
- Use Brickwork classes for controls and surfaces:
bw-btn, bw-card,
bw-alert, bw-field, type roles such as bw-heading-lg.
<main class="min-h-svh bg-surface text-fg">
<div class="mx-auto flex max-w-3xl flex-col gap-8 px-6 py-12">
<header class="flex items-start justify-between gap-4">
<div class="bw-stack bw-stack--gap-sm">
<h1 class="bw-display-lg">Tailwind-first</h1>
<p class="bw-body-md text-fg-muted">Utilities lay out the page; kit classes paint the chrome.</p>
</div>
</header>
<section class="grid gap-4 sm:grid-cols-2">
<article class="bw-card bw-card--size-md">
<h2 class="bw-heading-md">Card chrome</h2>
<p class="bw-body-sm">Raised with bw-card, not utility borders alone.</p>
</article>
<div class="flex flex-wrap items-center gap-3">
<button type="button" class="bw-btn bw-btn--primary bw-btn--size-md">Save</button>
<a class="bw-btn bw-btn--secondary bw-btn--size-md" href="#docs">Docs</a>
</div>
</section>
</div>
</main>
Worked page in the showcase app: /tailwind-first (contrast with
/tailwind-preset, which maps roles to utilities only and uses no bw-*
component classes).