Skip to Content
BBRICKSv0.7.4
Getting started

Introduction

What BRICKS is and what is in the package.

BRICKS is Ergasti's shared React component library. It is one source for the components, design tokens, themes and hooks that Ergasti dashboards use, so a project installs a pinned version of @ergasti/bricks instead of copying files.

Everything in it is presentational: props in, callbacks out. Nothing fetches on its own (the data hooks take the client you give them), nothing routes, and nothing imports app code. Every component speaks English and Arabic and mirrors in right-to-left layouts.

Overview

A row of KPI cards and a button, drawn by the library.

Code
import { Button, KpiCard, KpiGrid } from '@ergasti/bricks';

function Overview() {
  return (
    <div>
      <KpiGrid>
        <KpiCard tone="lime" icon="user" label="Active" value="301" sub="In your program now" />
        <KpiCard tone="sky" icon="creators" label="Groups" value="3" sub="Open the Groups tab" />
      </KpiGrid>
      <Button variant="rasp">Open</Button>
    </div>
  );
}

What is in the package

PartWhatDocs
KitPrimitives (Button, ButtonLink, Switch, …), patterns, dialogs, lists (DataTable, ListToolbar, Pager), charts, and money with its "?" notesKit
Provider and presetBricksProvider (language, statuses, tiers, currency, money notes and label overrides for every package) and trndrPreset (the TRNDR tables)The provider and presets
ShellThe dashboard frame: AppShell, sidebar, icon rail, phone tab bar and sheet, header, search, menus, usage meter, error boundaryShell
DataAn injected HTTP client and hooks: useResource, usePaged, useAction, URL state, useListState, useDrawerResourceData
BlocksThe Brand Dashboard v3 mock's building blocks: wallet, payouts, groups and their special commission, challenges, gifts, creators, settings, activityBlocks
PR blocksThe PR Portal v3 mock's building blocks: approvals, composer, brands, payouts, gifts and gift claims, tiers, leaderboards, audit log, permissions, column presetsPR Portal
Themestokens.css (the brand look, the default) and themes/pr.css (the PR Portal look): variables onlyDesign tokens

How these docs work

Every page is generated from the package source by npm run docs. The props tables, the labels tables, the design tokens, the A–Z index and the deprecation list are read from the code, so they follow it. The examples are real files in docs/examples/: the code under each example is cut from the same file that runs above it.

The Live examples switches in the sidebar change every live example on the page: Language (English or Arabic, which also sets dir and lang in the example frame), Theme (the brand look or the PR theme, through data-bricks-theme) and Preset (the TRNDR preset or the generic core). They are remembered in your browser. A few examples are pinned to one setting because they only make sense there; they say so.

The TRNDR preset is what a component draws when nothing says otherwise. Switch the preset to Generic to see what a component draws with no brand words at all.

Where to start

  • New to the library: Installation, then the Quick start.
  • Upgrading from an earlier release: Migration says what changes in each release, from 0.1.0 to the pending 0.6.0.
  • Looking for a component: use the search box (press /), the sidebar, or the A–Z index.
  • Building a screen: the Recipes put several components together with full code.

On this page