The second page is where a Bricks site either becomes a system or becomes a pile. The first page you style by feel: a blue you picked from the logo, a padding that looked right, a card with a rounded corner and a soft shadow. By the tenth page you have four slightly different blues, six paddings that differ by a few pixels, and three card variants nobody remembers building. Changing the brand colour means opening forty elements. Handing the site to someone else means handing them a guessing game. None of this is a Bricks problem. It is what happens when decisions are made at the element instead of being made once and referenced.
The single most important idea in this guide is that every style decision has one correct home, and the home depends on how widely the decision applies. A raw value that appears in many places belongs in a variable, so that it has a name and one definition. A default for plain elements such as body text, headings and buttons belongs in a theme style, written with those variables. A pattern that repeats across elements, such as a card or an eyebrow label, belongs in a global class. A structure with its own content belongs in a component. A true one-off belongs on the element. When each decision lives in the lowest layer that can own it, a change travels upward on its own: edit the variable and the theme style, the classes and the components that reference it all follow.
Bricks gives you every piece you need. The Style Manager in the builder brings together theme styles, global classes, CSS variables, a colour manager, fluid typography and spacing scales, and a framework importer. What it cannot give you is the discipline: names that survive a rebrand, a clear rule for what becomes a class, a cascade you understand well enough to predict, and a way to clean up a site that grew without one. That is what this guide supplies.
You will see the cascade between theme styles, classes, element settings and custom CSS, and a decision rule for where each value belongs. Then comes a naming scheme for variables and classes, followed by colour tokens with a light and a dark value, and spacing, radius, shadow and type tokens. A complete token file in plain CSS follows that you can paste into the global custom CSS area or bring into the variables manager. After that the guide covers theme styles written with those tokens, a global class library with a card example, a strategy for utility classes that avoids class soup, dark mode switching with a data attribute, and a step-by-step plan for refactoring a messy site. It ends with the failures you are most likely to meet and a short governance routine for teams.
Two honest notes. This is a general guide built from the public Bricks documentation, not a test report, and WPresident has not used Bricks to build these examples. Bricks changes between versions, so wherever a control name or a default might have moved, the text says to check the current Bricks documentation. And the colours, names and numbers in the examples are illustrations: they show a shape you can adapt, not a palette you must adopt. Try everything on a staging copy first, because a design system touches every page.
Key points
- Give every style decision one home: variables for values, theme styles for element defaults, global classes for repeated patterns, components for structures, and the element only for true one-offs.
- Name by role or step, never by appearance or number, so brand, text-muted, radius-m and space-m stay correct after a rebrand.
- Colours live in the colour manager as variables with optional dark values; Bricks outputs the dark values under the root data-brx-theme attribute set to dark, which any other token can follow.
- Theme styles are the broadest layer and global classes sit above them; element ID styles beat both, which is why one-off overrides must stay rare.
- Generate utility classes only for what you actually use, keep a small hand-written set under its own prefix, and lock foundational classes once they are stable.
- To refactor a messy site, define the tokens first, then replace raw values and merge duplicate classes, using the manager filters, and always on a staging copy.
Where a style can live, and which one wins
Before you build anything, learn the layers, because the rest of the system is a decision about which layer owns which value. Bricks lets a style land in several places, and when two of them set the same property, the cascade decides. People who skip this step end up fighting the builder, changing a class and seeing nothing happen, or changing an element and breaking forty others.
The broadest layer is the theme style. A theme style holds site-level or context-level defaults for plain elements: typography for body text and headings, link styles, button defaults, section padding, form fields and so on. It is chosen by conditions, much like a template, and Bricks outputs it before the more specific styles. It is the baseline, and the Bricks documentation is explicit that it is not a replacement for classes or element styles.
Above it sit global classes, reusable styles you can assign to many elements, and page settings, which apply to one page or template. Both are output after the theme style, so they override matching defaults. Above those sit the styles on a single element. Every Bricks element has an element ID, and when no class is active, the style controls write to that ID. Element ID styles are more specific than global class styles, so if the same property is set in both places, the ID usually wins. That is a feature when you want a one-off exception and a trap when a stray value on an element silently beats the class you are editing.
Two details matter for predictability. First, by default Bricks chains the global class with the element type class in the generated selector, so a class applied to a button produces something like the class name followed by the button’s own class. That raises specificity above a plain class selector. A setting in the Bricks performance options, called Disable class chaining, removes the chaining for edge cases where the higher specificity clashes with third-party CSS. It explains why your own custom CSS written as one bare class selector sometimes loses to a class styled through the builder controls. Second, when two classes on the same element set the same property with equal specificity, ordinary CSS rules decide, and the output order matters. A newer setting, Output global class CSS in Class Manager order, makes that order follow the order of the Class Manager. When it is off, Bricks outputs class CSS in the order the classes are met on rendered elements. If you rely on stacking classes, check that setting in the current documentation.
The last piece is the cascade layer Bricks uses for its own defaults. Bricks places its default styles and element CSS in a layer named bricks, with an empty bricks.reset sublayer as a safety net. Un-layered styles, which includes the custom CSS you add yourself, beat anything in a lower-priority layer regardless of selector specificity. In practice that means you rarely need to inflate your selectors to override a Bricks default, and it means a simple, flat custom CSS rule is usually enough. The documentation describes this as enabled by default in current versions, with a setting to turn it off that it does not recommend.
Underneath all of these layers sit the variables. They are not a style layer at all. They are named values that any layer can reference. That is why they are the foundation of the system: they let the broad layers and the specific layers agree on what “medium space” or “brand colour” means without any of them repeating the number.
Where a style can live, strongest at the top

A decision rule for where each value belongs
With the layers in mind, you need a rule you can apply in seconds, every time you reach for a control. Without one, the choice is made by whichever panel you happen to have open. The rule below asks one question per layer, from the cheapest decision to the most specific, and it stops at the first yes.
- Does the same raw value appear, or will it appear, in more than one place? A colour, a gap, a radius, a font size. If yes, it is a token. Give it a name in the colour manager or the variables manager and reference it with
var(--name)everywhere else. - Is it the default look of a plain element? Body text size, heading sizes, the standard button, the padding of every section. If yes, it belongs in a theme style, written with tokens, so a new element looks right before you touch it.
- Does a group of elements repeat the same pattern? A label above a heading, a card, a grid of cards, a visually quiet paragraph. If yes, it is a global class, named by purpose.
- Is it a structure with its own content slots? A product card with an image, a name and a price, a testimonial. If yes, consider a component that uses your classes, so content changes per instance and the structure stays single-sourced.
- Is it truly unique? A hero that needs extra bottom padding on one page. If yes, set it on the element, and accept that it is an exception.
The order matters because each yes pushes the decision down to a more specific home, and the more specific the home, the more expensive the change later. A value that should have been a token but was typed into an element costs you a hunt through the site. A pattern that should have been a class but was copied costs you one edit per copy. By contrast, a decision pushed up to a token or a theme style costs one edit.
The rule also tells you when not to create something. Not every repeated value deserves a variable. Bricks’s own variables guidance says to use variables for repeated values, not every one-off value, and that advice saves you from a manager full of names that are used once. Not every shared look deserves a class either. If an element pattern appears twice, copying it may be fine. At three or four, make the class. If the same combination of class and content repeats with different text, it is a component, and the Bricks documentation links components to the same system: components use classes and classes use variables, so a value change moves through all of them.
Use two sanity checks when you are not sure. If you can explain the decision in terms of the visitor, for example “all secondary text is quieter”, it probably belongs in a token or a class. If you can only explain it in terms of this one element, for example “this heading needs to sit closer to the image”, it belongs on the element. And watch for the opposite failure, a theme style carrying a dozen unrelated, overly specific rules. The documentation recommends a theme style for baseline typography and broad element defaults, and classes for reusable patterns. When a theme style begins to describe particular components, move those rules into classes.
Finally, remember that the layers form a chain of references, not a set of copies. A theme style that says “button background is var(–color-brand)” does not contain a colour. It points at one. A class that says “padding is var(–space-m)” points at the spacing token. The more of the system you write as references, the more a single change can do.
Where a value belongs
Naming: variables, classes and the names that survive a rebrand
Names are the design system’s interface. A name that describes a role keeps working when the value changes. A name that describes a value becomes a lie the moment the value moves. The simplest test is to imagine the client changing the brand colour from orange to teal. If your variable is called orange, you now have a teal called orange. If it is called brand, nothing needs renaming. The Bricks documentation gives the same advice for colours and for variables: name by role or step, such as a radius called radius-m, rather than by the number it currently holds.
Variables should read as a short, consistent vocabulary. Use a group prefix and a role or step: colours by role such as color-text, color-text-muted and color-surface; spacing, type and radius by size step such as space-m, text-l and radius-s. Use t-shirt sizes or numbered steps and stay consistent. Do not mix both inside one scale. Avoid starting names with bricks-, because Bricks uses that namespace for its own default colour variables. The colour manager and the variables manager also refuse duplicate names between them, so each token has exactly one definition.
Classes follow the same principle, with a structure on top. The Bricks documentation shows a pattern worth adopting: a base class for structure and default styling, a modifier class for a variation, and a utility class for a single property. In practice, that gives names like card as the base, card--featured as a modifier, and a small utility for a single concern. Write them in lowercase with hyphens. Name by purpose, so a class called text-muted survives a change of colour while grey-text does not. A class named after a number, such as a margin of thirty-seven pixels, encodes a value and will become wrong.
Plan for collisions early. The variables manager can generate utility classes for typography and spacing scales, using a pattern such as text-* for font-size, and the colour manager can generate utilities such as background, text and border classes named after your colours. Those names live in the same class list as the ones you write by hand. If you write your own utilities, give them a short prefix of their own, such as u-, so they never clash with generated names and so you can filter the class manager by name to find them. The class manager supports a name include and exclude filter, which turns a consistent prefix into a working search tool.
Two practical conventions help teams. First, write the naming rules down in one paragraph and keep them where people will see them: the token file header, a project README, or the first category of the class manager. Second, do not rename casually. Renaming a variable updates the references that Bricks manages inside builder data, but a reference typed into custom CSS or written in an external stylesheet keeps the old name, and the documentation says so directly. A rename is cheap on day one and expensive on day three hundred, which is why the vocabulary deserves a few minutes of thought before anything is built.
Fragile names and durable names
| Fragile name | Durable name | |
|---|---|---|
| Brand colour | orange | brand |
| Quiet text colour | grey-text | color-text-muted |
| Corner radius | radius-24 | radius-m |
| Gap size | gap-24px | space-m |
| A card variation | big-blue-card-v2 | card–featured |
| A one-property helper | margin-top-37 | u-mt-l |

Colour tokens: palettes, shades, roles and a dark value
Colour is where most sites decay first, because every element has a colour picker and a picker invites a one-off value. The fix is to make the tokens easier to reach than the raw values. Bricks does this with the Color Manager, in the Colors tab of the Style Manager. It stores colours in palettes, and each colour has a CSS variable name, a light value, an optional dark value, optional generated shades and optional utility classes. Colour controls open a palette popup, and when you pick a saved colour the element stores a reference to it, not a raw value, so editing the colour later updates everything that used it. The documentation is blunt about the flip side: a hex code typed by hand does not stay linked to the palette.
Think of colour tokens in two tiers. The first tier is a handful of brand colours with generated shades. Define your main colour once, enable light and dark shades and let Bricks generate the steps. Shades follow the base name: a light shade is the base name with -l-1 on the end, a dark shade -d-1, and a transparent shade -t-1, with the number as the step. A hover state is the natural use: set the button background to the brand colour and its hover background to the first dark shade, and a later brand change regenerates the hover too. The second tier is roles: names that say what a colour is for, such as the page background, a surface for cards, the text colour, a quieter text colour, a border, and a focus colour. Roles are what theme styles and classes should reference. A class that uses a role, not a brand shade, will follow when you swap the shade behind it.
Dark mode belongs in the same place. In the Color Manager you enable a dark value on a colour, and Bricks generates a starting value from the light one. The documentation tells you to treat that value as a starting point, not as finished design guidance, and to review contrast manually, especially for text and interactive states. Bricks outputs those dark values separately, under the root selector with the attribute data-brx-theme="dark". Because dark mode is just another set of values for the same variable names, a class or a theme style never needs to know which mode is active. It uses var(--color-text) and the value changes underneath it.
Contrast deserves a deliberate check, not a hope. WCAG asks for at least 4.5 to 1 for normal text and 3 to 1 for large text and for interface components such as input borders. Check text on background, muted text on surface, text on brand-coloured buttons and the border of a form field, in both modes. A decorative card border can be quiet. The border of a text field that tells a user where to type should not be. Giving that its own stronger token, rather than reusing the decorative one, keeps both jobs honest.
You do not need an extension to measure it. The WCAG contrast ratio comes from the relative luminance of the two colours, and the formula is short enough to paste into the browser console. It takes two hex colours written with six digits and returns the ratio.
function luminance(hex) {
var channels = [1, 3, 5].map(function (i) {
var c = parseInt(hex.slice(i, i + 2), 16) / 255;
return c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
});
return 0.2126 * channels[0] + 0.7152 * channels[1] + 0.0722 * channels[2];
}
function contrast(foreground, background) {
var a = luminance(foreground);
var b = luminance(background);
return (Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05);
}
console.log(contrast('#141a26', '#ffffff').toFixed(2)); // 17.42
console.log(contrast('#d5dbe5', '#ffffff').toFixed(2)); // 1.39
What it does: each colour channel is converted from the 0 to 255 range to a 0 to 1 value and linearised, which undoes the gamma curve that screens use. The three channels are then weighted by how bright the eye finds red, green and blue, which gives the luminance of the colour from 0 for black to 1 for white. The ratio compares the lighter and the darker luminance, with a small constant added to both so that pure black does not divide by zero. Run it on every pair that matters in both modes, and compare the result with 4.5 for normal text and 3 for large text and for interface components. The second figure below lists the pairs from the token file in this guide: the hairline card border scores 1.39 and is fine as decoration only, while the stronger border token clears 3 and is the one to use on form fields.
Utility classes are the last colour feature. For each root colour you can enable background, text, border, outline, fill or stroke utilities, and Bricks generates classes such as one named for a background and the colour, plus the same for the shades. Enable them only for colours you will actually apply as classes. Each enabled utility adds a global class per shade, and a library cluttered with a hundred classes nobody uses is harder to maintain than one that matches how you build. Surfaces and a few emphasis colours are the usual candidates, while brand shades are usually better used through components and theme styles.
The figure shows one possible role palette in light and dark mode. The names are roles, the values are illustrative, and the two columns use the same names with different values, which is the whole idea.


Spacing, radius, shadow and type tokens
Colours are the visible tokens. Spacing, shape and type are the ones that make a site feel consistent without anyone noticing why. The rule is the same: a small set of named steps, used everywhere, and no raw numbers in classes or theme styles.
Spacing works best as a scale of steps from very small to very large, with the middle step as the everyday gap. A short list such as 3xs, 2xs, xs, s, m, l and xl is enough for most sites. The odd number is a feature. Designers find a middle step to default to, and the smaller and larger steps appear only when there is a reason. Pair the scale with one or two special tokens for things that do not fit a step, such as the vertical padding of a full-width section. Spacing tokens go into section padding, row gaps, card padding and anything else that creates space. When a rule says “gap is space-m”, the whole site shares its rhythm.
Radius and shadow need only a few steps each. Three radii and a pill value cover buttons, inputs, cards and badges. Two shadows, a subtle one and a lifted one, cover resting and raised states. These are the values that quietly make two pages look related, and also the ones that drift when they are typed by hand. Dark mode usually needs shadows with a higher opacity, since a faint shadow on a dark surface disappears, which is one more reason to keep them as variables.
Type splits into families and sizes. Keep font families as tokens, a body family and a heading family, even when they are the same today. Sizes follow the same stepped logic as spacing, and the most useful sizes are fluid, so headings grow with the viewport instead of jumping at breakpoints. The Style Manager has Typography and Spacing tabs that generate those fluid scales for you. You set a base size and a ratio for a smaller and a larger viewport, and Bricks generates variables whose values use the CSS clamp() function, with names built from the prefix you choose. You can also override individual values in manual mode, and generate utility classes for a scale. The companion tutorial in this series on fluid typography and spacing covers how those numbers are calculated and how to write your own.
You now face a real choice, and you should make it once: generate the scales in the Style Manager, or write them yourself as plain variables. The generated route gives you the scale controls, a consistent naming scheme, and utility classes if you want them. The hand-written route gives you full control over every value and a token file you can keep in version control. Either is fine, and mixing them for the same family of tokens is not. If the Typography tab owns the text sizes, do not also define text sizes in custom CSS with the same names. The variables manager and the colour manager refuse duplicate names between themselves, but a variable defined in global custom CSS is outside that protection, and the later definition in the cascade silently wins.
The figure shows spacing steps as bars, with the radii and the two shadows underneath them. They are sizes rendered with plain CSS from the same values that appear in the token file in the next section.

A paste-ready token file
Here is a complete token file in plain CSS. It uses only role and step names, and it stays small on purpose. The values are examples. Replace them with your own, and keep the names. You can place it in two ways. For the whole site, paste it into the global custom CSS area under Bricks, Settings, Custom code. The documentation says that global custom CSS is added at the end of the document head. For the builder variable picker, import the name and value lines into the variables manager instead, as described after the code.
/* Design tokens. Role and step names only. Define each name in one place. */
:root {
/* Colour roles, light mode */
--color-bg: #ffffff;
--color-surface: #f3f5f9;
--color-text: #141a26;
--color-text-muted: #4f5b6d;
--color-border: #d5dbe5;
--color-border-strong: #6b7788;
--color-brand: #1d4ed8;
--color-brand-strong: #163aa3;
--color-on-brand: #ffffff;
--color-accent: #b45309;
--color-focus: #1d4ed8;
/* Space */
--space-3xs: 0.25rem;
--space-2xs: 0.5rem;
--space-xs: 0.75rem;
--space-s: 1rem;
--space-m: 1.5rem;
--space-l: 2.5rem;
--space-xl: 4rem;
--space-section: clamp(3rem, 2rem + 5vw, 6rem);
/* Shape */
--radius-s: 0.375rem;
--radius-m: 0.75rem;
--radius-l: 1.25rem;
--radius-pill: 999px;
--shadow-s: 0 1px 2px rgb(16 24 40 / 0.08);
--shadow-m: 0 8px 24px rgb(16 24 40 / 0.12);
/* Type */
--font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
--font-heading: var(--font-body);
--text-s: 0.875rem;
--text-m: 1rem;
--text-l: 1.25rem;
--heading-m: clamp(1.25rem, 1.05rem + 1vw, 1.75rem);
--heading-l: clamp(1.5rem, 1.15rem + 1.75vw, 2.5rem);
--heading-xl: clamp(2rem, 1.4rem + 3vw, 3.5rem);
/* Layout */
--container: 75rem;
--gutter: var(--space-m);
}
/* Dark mode: the same names with different values. */
:root[data-brx-theme="dark"] {
--color-bg: #0e131b;
--color-surface: #161d28;
--color-text: #edf0f5;
--color-text-muted: #a5afbf;
--color-border: #2a3444;
--color-border-strong: #7b879a;
--color-brand: #7ea2ff;
--color-brand-strong: #a9c1ff;
--color-on-brand: #0e131b;
--color-accent: #f0b252;
--color-focus: #a9c1ff;
--shadow-s: 0 1px 2px rgb(0 0 0 / 0.4);
--shadow-m: 0 8px 24px rgb(0 0 0 / 0.5);
}
What each block does. The first :root block defines every token on the document root, so every element can read it. The colour roles are the names theme styles and classes should reference, and the on-brand colour is the text colour that sits on top of a brand background, so you never hard-code white on a button. The space steps are fixed rem values, and --space-section is a fluid value that moves between a minimum and a maximum as the viewport changes, which suits the vertical padding of full-width sections. The shape tokens cover radius and shadow. The type tokens set two families, three fixed text sizes and three fluid heading sizes, using clamp(). The next tutorial in this series shows how to derive such values.
The second block is the dark mode. It redefines only the tokens whose values change, under the same root selector that Bricks documents for dark values, so anything that references var(--color-text) adapts without edits. Shadows get a heavier opacity because they must show on dark surfaces. The text values were chosen so that the main text pairs clear the 4.5 to 1 level in both modes by a wide margin, but run your own check whenever you change a value.
Two ways to use the file. If you paste it as global custom CSS, the variables work on the frontend and in your own CSS, but they are not listed in the builder’s variable picker. If you want them in the picker, use the variables manager’s manual text import, which accepts a semicolon-separated list of CSS variable definitions, and paste only the name and value lines, not the wrapper or the comments. The documentation says a manual import adds variables that do not already exist by name and skips existing ones. The manager holds a single value per variable, so the dark values stay in custom CSS, or move colours into the Color Manager and use its dark mode switch. Whichever route you take, do not define the same name in two places.
The theme style: element defaults written entirely with tokens
With tokens in place, the theme style is the quickest win, because it styles every plain element on every page at once. Open the Style Manager in the builder, choose Theme styles, give the style a name and save it. A theme style has two parts: conditions, which say where it applies, and settings, which say what it outputs. When you create the first theme style on a site, Bricks adds the Entire website condition for you, and the documentation recommends starting with one site-wide style for baseline typography, links and broad element defaults. A theme style without any condition never becomes active, which is the first thing to check if nothing seems to happen.
The discipline is simple: every value you type in a theme style is a token reference, never a raw number or colour. The groups you will use most are the typography groups for body text and headings, the links group, and the element groups for buttons, sections and containers. A sensible mapping looks like this.
- Body text: family
var(--font-body), sizevar(--text-m), colourvar(--color-text). - Headings: family
var(--font-heading)and the text colour role, with the first three heading levels set tovar(--heading-xl),var(--heading-l)andvar(--heading-m). - Links: colour
var(--color-brand), with the stronger brand token on hover. - Button: background
var(--color-brand), textvar(--color-on-brand), border radiusvar(--radius-s), and the strong brand token as the hover background. - Section: vertical padding
var(--space-section)and horizontal paddingvar(--gutter). - Container: width
var(--container), and a row gap from the spacing scale for stacked children.
Check each group’s current labels in the theme style panel, because the exact controls depend on the active Bricks version and the registered elements. Write the value into the field with the variable picker, the small CSS icon at the end of many fields, or type the reference by hand. When a theme style is saved, the whole site shifts at once, including header and footer templates, because those are ordinary Bricks content. Resize to a mobile width: with fluid tokens, headings and section padding shrink without a single breakpoint-specific setting.
Two behaviours of theme styles decide how you can organise them. First, by default Bricks loads only the most specific matching theme style. If a landing-page theme style matches a page, it replaces the site-wide one for that page, it does not add to it. That means a context-specific theme style has to be complete, or you have to change the loading method. The setting is in the Bricks settings, General tab, under Theme Styles, Loading Method, and the alternative is to load all matching theme styles, in which case Bricks orders them by specificity and the normal cascade settles any property that two of them set. Use stacking only when you mean it, and keep each stacked style focused. Second, theme styles can be exported and imported as JSON, which is how you carry a baseline between sites. If a style with the same ID already exists, the import skips it, so rename or duplicate before exporting when you want a separate copy.
Keep one more boundary in mind. The theme style also has a Stylesheet group for custom CSS that belongs to that style’s context. It is plain CSS, with no breakpoint awareness of its own, so write media queries when you need them. Use it for rules tied to the same conditions as the theme style, and keep truly global CSS in the global custom code area, where it does not depend on which theme style wins.
Global classes: a library of patterns, built once
A theme style knows nothing about the small label above a heading or the quiet paragraph under a title. Those are patterns, and patterns need classes. In Bricks, a global class is a reusable style target. You select an element, type a name into the selector field under the element name, and press Enter. From then on any element can use it, and editing the class edits every element that uses it.
The mental model the documentation gives is worth memorising, because it prevents the commonest accident. Every element has an element ID, and the selector field at the top of the panel shows the active target. When the ID is active, the controls write to that one element. When a class is active, the controls write to the class, and every element with that class changes. Assigning a class and having it active are different states. If you add a class and then deselect it, you are back to styling the element ID. That is the safest way to style one element without touching the others, and it is also how people accidentally restyle forty cards when they meant to nudge one. Look at the selector field before you change a control.
Build classes in the order of the structure from the naming section: a base class, then modifiers, then a very small number of utilities. For a card, the base class sets the surface, border, radius, padding and shadow, all from tokens. A modifier changes only what differs. Here is a pattern that keeps modifiers independent of output order. The base class reads local custom properties with fallbacks, and the modifier only sets those properties.
/* Class: card (custom CSS in the class) */
%root% {
--card-border: var(--color-border);
--card-shadow: var(--shadow-s);
background: var(--color-surface);
color: var(--color-text);
border: 1px solid var(--card-border);
border-radius: var(--radius-m);
padding: var(--space-m);
box-shadow: var(--card-shadow);
}
/* Class: card--featured */
%root% {
--card-border: var(--color-brand);
--card-shadow: var(--shadow-m);
}
/* Class: card-grid */
%root% {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
gap: var(--space-m);
}
The placeholder %root% is a Bricks convention that stands for the element ID or the class you are editing, and Bricks converts it to the right selector. In current versions the Class Manager has a Custom CSS editor for the selected class, so you can write this without finding an element that uses it first, and the same placeholder works in the element-level CSS group. In the base class, the two local properties start with token fallbacks and feed the real declarations. The featured modifier sets only those two properties, so it does not compete with the base over the same declaration. It works whichever class comes first in the output. The grid class makes as many columns as fit, never narrower than 18rem, and the min() inside minmax() stops the columns from overflowing on a very narrow screen.
The Class Manager is where you keep the library healthy. Group classes into categories such as Layout, Typography and Components. Filter by used or unused, by classes with or without styles, and by locked or unlocked. Rename or duplicate several classes at once with a find and replace, a prefix or a suffix. Lock foundational classes when they are stable, which stops accidental edits and also blocks rename and delete on a selection that includes them. Deleting from the list moves a class to a trash view where it can be restored, which is different from removing a class from one element. And note a performance detail from the documentation: Bricks generates class CSS only for classes used by elements in the rendered context, so an unused class costs a record but not frontend CSS.
Finally, use pseudo-class and custom-selector support for states. The documentation says to use class selectors for reusable states such as hover and focus, and element IDs only for one-off exceptions. If you write focus styles on a class, give them a visible outline, and respect reduced motion for any transition you add.

A utility-class strategy that does not become class soup
Utility classes are single-purpose classes: centre this text, hide this visually, give this element a medium gap. They are useful, and they are the easiest part of a design system to overdo. A site where every element carries seven utilities has not escaped inline styles. It has relocated them into the class attribute, and it is just as hard to change. The strategy below keeps them useful.
Recognise the three sources. Generated utilities come from the Style Manager: the colour manager can generate background, text, border, outline, fill and stroke classes from your colours, and a typography or spacing scale can generate classes from a pattern such as one named for the property and the step. These are stored as global classes, appear in the class list, and are written into a generated Style Manager CSS file. The documentation advises generating only what you actually use. Hand-written utilities are the small helpers you create yourself. Pattern classes are not utilities at all: a card, a grid, an eyebrow label. Keep the categories separate in the Class Manager, and give hand-written utilities their own prefix, so you can filter them at a glance.
Apply three tests before you add a utility. It must express one property or one tight idea. It must repeat across unrelated elements, otherwise it is a pattern and deserves a purposeful name. And it must not duplicate something Bricks already does well: layout gaps and alignment are usually better set through the container’s own controls than through margin helpers on every child. A good starting set is small: a centred-text helper, a visually-hidden helper for text that only assistive technology should read, and a vertical-rhythm helper for stacked content. Create each as a global class with custom CSS using the placeholder, and give it the utility prefix.
/* Class: u-center */
%root% {
text-align: center;
}
/* Class: u-visually-hidden */
%root% {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
border: 0;
}
/* Class: u-stack */
%root% > * + * {
margin-top: var(--stack-gap, var(--space-m));
}
The visually-hidden class removes an element from view while leaving it available to screen readers, which suits a label for an icon-only button. The stack class adds space between consecutive children, and it reads a local custom property with a token fallback, so a container can set --stack-gap for a tighter or looser rhythm without a second class. Note the selector: it targets the children of the element that carries the class, which is why the placeholder is followed by a child combinator.
Set rules for when a utility graduates into a pattern. If you find the same four utilities together on several elements, replace them with one named class. If an element has more than three or four utilities, ask whether the page is describing a pattern. And once the library settles, lock the foundational and generated classes, so that a casual change in the class manager does not alter forty pages. The documentation recommends locking for layout wrappers, button bases, typography classes and generated utilities.
The decision between a utility and a pattern is easier with the two side by side, as the figure shows. When in doubt, prefer the pattern: a descriptive class name is searchable, reviewable and renameable in one place, and the page markup then says what the element is, not how to paint it.
Utility classes and pattern classes
| Utility class | Pattern class | |
|---|---|---|
| What it does | One property or one tight idea | A whole look for one kind of element |
| Example names | u-center, u-visually-hidden | card, card-grid, eyebrow |
| Create it when | A property repeats on unrelated elements | The same cluster of properties repeats |
| Main risk | Class soup on every element | Many near-duplicate variants |
| Housekeeping | Own prefix, small set, locked | Base class plus modifiers, in a category |
Dark mode with a data attribute
Dark mode is a good test of a design system, because it only works if the system is real. If every colour is a role token, switching modes means swapping values for a handful of names. If colours are scattered as raw values, dark mode means rewriting the site. The mechanism is small: a data attribute on the root element decides which set of values applies, and CSS custom properties do the rest.
Bricks documents its own attribute for this. Dark values defined in the Color Manager are output under the root selector with data-brx-theme set to dark. That is the hook to build on. The token file in this guide uses the same selector for its dark block, so your own tokens and the Color Manager’s tokens switch together. The Bricks Toggle Mode element gives visitors a button to switch. It renders a button with a light icon area and a dark icon area, shows the correct one for the active mode, and defaults its accessible label to Toggle mode when you leave the field empty. It depends on dark values existing in the Color Manager. If no colour has a dark value, the sun and moon control in the builder toolbar does not appear, and the same logic applies to the frontend behaviour.
The recommended path is therefore: define roles as colours, give each a dark value, review the generated dark values for contrast, add the Toggle Mode element to the header, and put any non-colour overrides such as shadows in the dark block of your custom CSS under the same selector. Then test the details the documentation does not spell out: what the attribute is on first load, what happens on reload, what happens in a second tab, and what happens for a visitor whose operating system prefers dark. Open your browser’s element inspector on the root element and watch the attribute, rather than assuming.
Before you write any CSS for the operating system preference, look at the Settings tab of the Style Manager. It has a colour mode setting with three options: always start in light mode, always start in dark mode, or Auto, which follows the system preference. If Auto does what you want, you need nothing more. If you need your own rule, for example for tokens that live only in custom CSS, you can add a media query for the preference, scoped so it applies only while no explicit attribute is set. It repeats the dark values, which is the cost of doing it in plain CSS, so keep the block short and generate it from the same source if you can.
@media (prefers-color-scheme: dark) {
:root:not([data-brx-theme]) {
--color-bg: #0e131b;
--color-surface: #161d28;
--color-text: #edf0f5;
--color-text-muted: #a5afbf;
}
}
This rule only matters if the page loads with no attribute. If Bricks or your script always sets an attribute, the rule never fires, so check the real behaviour before you count on it. Add the remaining dark tokens to this block, or skip the block if the explicit switch is enough for your audience.
If you do not use the Toggle Mode element and want your own button, use a small script that flips the same attribute and remembers the choice. Put it in the global Header scripts field under Bricks, Settings, Custom code, which the documentation says is added right before the closing head tag, so the saved choice applies before the page paints and avoids a flash of the wrong mode. Wrap the code in script tags there, as the documentation requires for those fields. Give your button the attribute data-theme-toggle, using the Bricks custom attributes feature on the element, and use this instead of the Toggle Mode element, not alongside it.
<script>
(function () {
var root = document.documentElement;
var KEY = 'site-theme';
try {
var saved = localStorage.getItem(KEY);
if (saved === 'dark' || saved === 'light') {
root.setAttribute('data-brx-theme', saved);
}
} catch (e) {}
document.addEventListener('DOMContentLoaded', function () {
var dark = root.getAttribute('data-brx-theme') === 'dark';
document.querySelectorAll('[data-theme-toggle]').forEach(function (button) {
button.setAttribute('aria-pressed', dark ? 'true' : 'false');
});
});
document.addEventListener('click', function (event) {
var button = event.target.closest('[data-theme-toggle]');
if (!button) { return; }
var next = root.getAttribute('data-brx-theme') === 'dark' ? 'light' : 'dark';
root.setAttribute('data-brx-theme', next);
button.setAttribute('aria-pressed', next === 'dark' ? 'true' : 'false');
try { localStorage.setItem(KEY, next); } catch (e) {}
});
})();
</script>
What the script does. It reads a saved choice inside a try block, because storage can be blocked in private windows or with strict privacy settings, and applies it to the root element at once. When the page is ready it sets the pressed state on every toggle button, so assistive technology hears the current mode. It listens for clicks on the whole document, which works even for buttons that appear later, flips the attribute, updates the pressed state and tries to save the choice. Nothing else on the page needs to know, because the tokens already react to the attribute. The figure shows one card in both modes, rendered from the same CSS with only the token values swapped.

Refactoring a messy site into a system
Most real projects do not start clean. You inherit a site with raw colours in the elements, forty classes that nobody can explain, and three theme styles that overlap. The temptation is to fix it everywhere at once. Resist it. A refactor that changes every page in one go is a refactor you cannot verify. Go in layers, from the bottom of the stack up, and check after each one.
1. Back up and stage. Take a full backup, and do the work on a staging copy, because a design system touches every template. Know how to restore. Note which pages matter most to the business, because those become your regression pages.
2. Inventory. List what the site actually uses. For colours, open a few key templates and write down the distinct values. For classes, open the Class Manager and use its filters: used and unused across the whole site, classes with no styles, locked and unlocked. For variables, the variables manager has the same kind of usage filters. Read those filters as hints, not verdicts. The documentation warns that an item unused on the current page may still be used elsewhere, so check the whole site before deleting anything. If a framework or an old stylesheet sits behind the site, the Framework tab in the Style Manager can parse external CSS and convert it into Bricks classes and variables, with a prefix option to avoid name clashes and a review step before anything is added.
3. Define the tokens. Decide the role names and the scales first, with the real values from your inventory snapped to a small set. Six near-identical blues become one brand colour with shades. Nine paddings become a seven-step scale. This step is a design decision and takes the longest, but it is the one that pays off for years.
4. Rebuild the theme style. Move the element defaults into one site-wide theme style written with tokens, then remove the same values from individual elements. The documentation notes that class styles and element IDs override a theme style, so leftover element-level values will hide your new defaults until you clear them.
5. Consolidate the classes. Group duplicates, pick the survivor, and rename with the bulk tools: find and replace, prefix and suffix work across a selection, and Bricks skips names that would collide. Move the losers to the trash view first, not to permanent deletion, so you can restore if a page breaks. Put survivors into categories and lock the foundational ones.
6. Replace raw values. Work template by template, starting with the header, footer, single and archive templates, because each of those touches many pages. Replace typed colours with palette colours or variables, and typed spacing with tokens. The documentation pages for the managers do not describe a bulk tool that swaps raw values for tokens across a whole site, so if your version has one, check the current documentation and test it on staging first.
7. Check and document. After each layer, view the regression pages at a narrow, a medium and a wide width, in both colour modes if you use them. If you load CSS as external files, use the Regenerate CSS files button after large changes. Then write down the naming rules and the token list.
Two traps deserve a warning. Renaming a variable updates Bricks-managed references, but a reference typed in custom CSS or in an external stylesheet keeps the old name, so search your custom CSS for it afterwards. And a typed hex is not linked to anything: if you meant a palette colour, replace the value with the palette entry, not with the same hex again.
A refactor from the bottom of the stack up
What goes wrong: symptoms and causes
Design system problems have recognisable symptoms. This section maps the common ones to their usual causes, in the order you should check them.
“I changed the class and nothing happened.” The element probably sets the same property on its own ID, which beats the class. Select the element, make the ID the active target, and look for the property. Also check that the class is not locked, that the class has styles for the element type, and that custom CSS elsewhere is not overriding it. Remember that by default Bricks chains the class with the element type in the selector, which raises its specificity above a bare class in your own custom CSS.
“I changed one element and many changed.” A class was the active target. That is expected behaviour: a global class is shared. If only one element should change, clear the active class and style the ID, or create a modifier class.
“My variable does nothing.” Check that it exists, has a valid name and has a non-empty value, because Bricks outputs only variables with both. Check that the control accepts a variable reference, and that the name is spelled exactly as it is defined, including any prefix. If the reference lives in custom CSS after a rename, it still has the old name.
“Dark mode works on some elements only.” The elements that did not change use raw values, not role tokens, or their colour has no dark value, or a stronger rule overrides the token. Also confirm in the inspector that the root element carries the dark attribute, and that the generated CSS is current.
“The utility classes are missing.” Check that the scale or colour has utility generation switched on, that the category is a scale, and that Bricks can write and enqueue its generated Style Manager CSS file. If the file could not be written, the documentation points to file permissions and cache configuration, and to regenerating Bricks CSS files.
“My theme style does nothing.” It has no condition, an exclude condition applies, or another theme style is more specific and the loading method is the default, in which only the most specific matching style loads. Switch the loading method only if you want styles to stack.
“An imported template broke my classes.” Imported classes are matched by ID and name, and a class with the same name but different settings is a conflict. Bricks can open its global class import manager for conflicts, for new classes or for both, depending on a Bricks builder setting, and it can also be set to skip the prompt entirely. On a production site with a real system, leave it on for conflicts and review each one before accepting.
“Two classes on one element fight.” They set the same property at the same specificity, so the output order decides. Remove the overlap, use the custom-property pattern from the classes section, or turn on the setting that outputs class CSS in Class Manager order and arrange the classes accordingly.
“Variables went missing after a move.” Variables imported with a remote template are matched by name, existing ones are not duplicated, and the categories are not imported with them, so they can arrive uncategorised. Export and import variables as JSON when you need the categories.
Keeping the system healthy on a team
A design system is a shared asset, and shared assets decay when everyone can edit them. The tools that keep it healthy are permissions, locks, exports and a small amount of ritual.
Permissions. Bricks makes the managers permission-based. Colour manager access is a builder permission, and global class actions have separate permissions: create, edit, assign, delete, lock and copy-paste of class styles. An administrator can also switch off the Global Class Manager and the CSS variables manager in the Bricks settings. For client handoff, the builder access settings include a mode in which content editing is possible while layout, styling and structural controls are disabled. Give editors that, and keep the design system in the hands of the people who maintain it.
Locks. Lock the classes that define your structure once they are stable. A locked class can still be assigned but cannot be edited until someone with permission releases the lock. This is the cheapest guard against an accidental change to a class that fifty pages rely on.
Multi-user safety. If class synchronisation or conflict checking is enabled, Bricks can detect that another user changed global classes after your builder session loaded and report added, modified and deleted classes and true conflicts when you save. Read those notifications before continuing, because they exist to stop two people silently overwriting one another.
Reuse across sites. Variables, classes, palettes and theme styles can all be exported as JSON and imported elsewhere. That is the basis of a starter kit: build the system once, export it, and import it into each new project, then adjust the values. Imports skip or flag items that already exist, so on an existing site, review the results instead of assuming the import matched your naming. Imported palettes in particular are not adapted to your existing naming scheme.
Ritual. Put a short review on the calendar. Look for unused classes, classes with no styles, variables unused anywhere, near-duplicate classes, and raw values creeping back into templates. Check the contrast of any new colour. Keep the token file, or an export of the variables and palettes, in version control or a shared folder, with a changelog line when a value moves. When a new person joins, give them the naming rules and the decision rule from this guide, and ask them to build one page with no element-level styles. If they can, the system works.
The payoff is the experience the Bricks documentation describes: a new page needs no new styles, and changing one value updates every page that uses it. That only happens if the decisions live in the right layer. Keep them there, and a rebrand becomes an afternoon of editing tokens, not a month of hunting.
Checklist
- Write down the five layers (variables, theme style, global classes, components, element) and the decision rule for choosing between them.
- Name colours, spacing, radius and type by role or step, never by appearance or by the number they hold.
- Avoid the bricks- prefix for your own variables, and define each token name in exactly one place.
- Create colour roles for background, surface, text, muted text, border, brand and focus, with dark values for each.
- Check contrast for text, muted text, text on brand buttons and form field borders in light and dark mode.
- Enable colour utility classes only for the colours you will really apply as classes.
- Choose once between generated scales in the Style Manager and hand-written tokens for each token family.
- Paste the token file into global custom CSS, or import its name and value lines into the variables manager.
- Build one site-wide theme style with conditions, using token references only and no raw values.
- Decide whether context-specific theme styles replace the site-wide one or stack, and set the loading method to match.
- Look at the selector field before every style change so you know whether a class or the element ID is active.
- Build pattern classes as a base plus modifiers, and let modifiers set local custom properties so output order does not matter.
- Give hand-written utility classes their own prefix, keep the set small and lock it once it is stable.
- Put classes in categories and lock the foundational ones; use the trash view before permanent deletion.
- Use data-brx-theme on the root element for dark values, and verify its behaviour on load, reload and in a second tab.
- Refactor from the bottom up on a staging copy: tokens, theme style, classes, then templates, then pages.
- Search custom CSS and external stylesheets for old variable names after any rename.
- Export variables, classes, palettes and theme styles as JSON for reuse, and keep a review routine for unused items and raw values.
Read this next
About this guide. This is general guidance written by WPresident Editorial from documentation and widely used practice. WPresident has not benchmarked the products or methods described. Interfaces and plan limits change, so check the vendor’s current documentation before you act. Not legal, tax or financial advice. See our editorial policy.
Frequently asked questions
What is the difference between a theme style, a global class and an element style in Bricks?
A theme style holds defaults for plain elements and applies by conditions, so it is the broadest layer. A global class is a reusable style you assign to many elements, and it is output after the theme style. An element style is written to the element's own ID, is more specific than a class, and is meant for one-off exceptions. Keep shared decisions at the broadest layer that can own them.
Should I use the Color Manager or plain CSS variables for colours?
The Color Manager is the better default, because colour controls then show a palette, selected colours stay linked to their variable, shades and utility classes can be generated, and dark values are supported. Plain CSS tokens suit non-colour values and teams that keep tokens in version control. Whichever you pick, define each name once, because the managers refuse duplicates but global custom CSS is outside that check.
How do I name global classes in Bricks?
Use lowercase words with hyphens and name by purpose, not appearance. A base class such as card, a modifier such as card--featured, and a small set of prefixed utilities cover most needs. Give hand-written utilities their own prefix so they never clash with generated classes and can be found with the name filter. Avoid names that encode a value, because the value will change.
Why does my class not change the element?
The usual cause is that the element sets the same property on its own ID, which is more specific than a class. Others are a locked class, a class with no styles for that element type, and custom CSS with a stronger selector. Bricks also chains the class with the element type by default, which raises specificity above a bare class selector in your own CSS.
Where do I paste a CSS token file in Bricks?
Paste it into the global custom CSS area under the Bricks settings, Custom code tab, which is output at the end of the document head. If you want the variables in the builder picker, import only the name and value lines through the variables manager's manual text import instead. The manager holds one value per variable, so dark values stay in custom CSS or in the Color Manager.
How does dark mode work with Bricks colours?
In the Color Manager you enable a dark value on a colour. Bricks outputs those values under the root selector with data-brx-theme set to dark. Anything that references the variable changes automatically. The Toggle Mode element gives visitors a switch. Review the generated dark values for contrast, because the documentation calls them a starting point, and verify the attribute behaviour on load yourself.
Should I generate utility classes from my scales and colours?
Only for what you will use. Each enabled colour utility creates a global class per shade, and scale utilities add more, which clutter the class list and make it harder to find the classes that matter. Start with none or a few, add more when a pattern repeats, and lock the generated classes once they are stable so they are not edited into something else.
Can I have more than one theme style?
Yes. Each has conditions. By default Bricks loads only the most specific matching theme style, so a landing page style replaces the site-wide one on that page and must be complete. In the Bricks settings under General you can change the loading method to load all matching styles, which stack by specificity. Use stacking deliberately and keep each style focused.
What happens to my references when I rename a variable?
Bricks updates the references it manages in builder data, in the builder and again on save. A reference typed into custom CSS or written in an external stylesheet keeps the old name and must be changed by hand. Rename sparingly on production sites with a lot of custom CSS, and search your CSS after any rename.
How do I clean up a site that already has hundreds of classes?
Work on a staging copy. Use the Class Manager filters for unused classes and classes without styles, but check the whole site before deleting, because unused on this page does not mean unused. Merge duplicates, rename in bulk, move losers to the trash first, categorise survivors and lock the foundational ones. Define tokens before touching pages, and replace raw values template by template.
Can I share a design system between several Bricks sites?
Yes. Variables, classes, palettes and theme styles can each be exported as JSON and imported on another site, which makes a starter kit. Imports add what does not exist by name or ID and flag conflicts, so review the result on any existing site. Remote template variable imports do not bring their categories, so use JSON when categories matter.



