Skip to Content
BBRICKSv0.7.4
Getting started

Stylesheets

tokens.css, styles.css and the per-area files, and the order to load them in.

The package exports these stylesheets (from package.json exports):

ImportWhat it holds
@ergasti/bricks/tokens.cssThe design tokens: custom properties on :root. No element rules and no @font-face.
@ergasti/bricks/styles.cssEvery component style, in order: kit, shell, blocks, PR blocks.
@ergasti/bricks/kit.cssThe kit's styles alone, for an app that uses only the kit.
@ergasti/bricks/shell.cssThe shell's styles. Load after kit.css.
@ergasti/bricks/blocks.cssThe brand blocks' styles. Load after kit.css.
@ergasti/bricks/pr.cssThe PR blocks' styles (not the PR theme). Load after kit.css.
@ergasti/bricks/themes/pr.cssThe pr theme: variables only, scoped to [data-bricks-theme='pr'].

Load order

  1. tokens.css first: the component styles read its variables.
  2. themes/pr.css after tokens.css, only if you use the PR theme.
  3. Then either styles.css, or kit.css followed by the area files you need. Never both: styles.css already contains the others.
// Everything
import '@ergasti/bricks/tokens.css';
import '@ergasti/bricks/styles.css';

// Kit only
import '@ergasti/bricks/tokens.css';
import '@ergasti/bricks/kit.css';

// Kit + shell, with the PR theme
import '@ergasti/bricks/tokens.css';
import '@ergasti/bricks/themes/pr.css';
import '@ergasti/bricks/kit.css';
import '@ergasti/bricks/shell.css';

Each area file holds every stylesheet of its area. A release can add rules or files inside an area (0.6.0 adds the PR Portal's gift claims and focusable decision codes to pr.css) without a new import path, so the imports above stay the same from release to release.

The order inside the component styles is part of the API: a later file may override an earlier one. The sequence is the kit's primitives, cells, patterns, data table, v3 and kit files, then lists, then the shell, the blocks and the PR blocks. styles.css and the split files keep that order for you; do not reorder or cherry-pick files out of dist/.

What the styles do and do not do

  • There is no global reset and no body rule. The kit styles its own classes (kit-…).
  • One rule is wider than that: the console-era select chevron applies to select.kit-select and to selects inside a Toolbar. A select of your own does not get it unless you add className="kit-select" (the 0.2.0 change is described on Migration).
  • The library ships no fonts. See Installation.
  • Sizes and colours that a theme may change are custom properties declared in tokens.css (the theme hooks). Override them after tokens.css, never by editing a component's class. See Theming.

Per-page weight

styles.css is the biggest file because it holds all four packages. An app that only uses the kit, or the kit and the shell, loads less with the split files. Run your bundler's analyser on your own build to see the real numbers.

On this page