Skip to Content
BBRICKSv0.7.4
KitPrimitives

Deco

The mock's svg.deco: a soft shape in the tile's own ink (currentColor), behind the text. Position, size and opacity come from the container's CSS (.kit-deco in patterns.css), as in the mock.

import { Deco } from '@ergasti/bricks';

Examples

Corner shapes

The faint blob and star the mock draws in the corner of a tile or card. Place it inside a positioned parent; it is decorative.

Code
import { Deco } from '@ergasti/bricks';

function Shapes() {
  return (
    <div style={{ display: 'flex', gap: 16 }}>
      {(['blob', 'star'] as const).map((kind) => (
        <div key={kind} style={{ position: 'relative', width: 160, height: 100, overflow: 'hidden', borderRadius: 16, background: 'var(--lime-50)' }}>
          <Deco kind={kind} />
        </div>
      ))}
    </div>
  );
}

Props

Prop

Type

Design guidance

How the BRICKS design system uses Deco. Written in docs/content/components/Deco.md; the props above are read from the code, which wins where the two disagree.

A soft decorative shape (blob or star) drawn behind a tile's text in the tile's own ink; use it through a Tile, KpiCard or HeroCard deco prop.

Deco is the mock's svg.deco. The mock shipped the shapes empty, so BRICKS draws its own two: a rounded blob and a four-point star. The SVG fills with currentColor, so it takes the ink of the card it sits in; its position, size and opacity come from the container's CSS (top-end corner, 150px at 12 % on a Tile; bottom-end, 200px at 8 % on the hero). It is decoration only and hidden from assistive tech.

Anatomy

  1. SVG (svg.kit-deco, viewBox 100 × 100, aria-hidden, focusable="false", data-deco={kind}).
  2. Path filled currentColor.

Variants

kindShapeTypical host
'blob'Rounded organic blobSales and Commission tiles
'star'Four-point sparkleOrders and ROI tiles

Placement per host (from CSS):

HostPositionSizeOpacity
Tileinset-inline-end: -26px; top: -34px150px0.12
KpiCardinset-inline-end: -22px; top: -30px112px0.12
HeroCardinset-inline-end: -30px; bottom: -40px200px0.08

States

None: static, pointer-events: none.

Usage

Usually via the host:

<Tile size="metric" tone="lime" label="Sales" value={<Money value="312400.00" compact />} delta={<Delta value={9.6} />} deco="blob" />
<Tile size="metric" tone="rasp" label="Orders" value="1,284" delta={<Delta value={7.9} />} deco="star" />

Directly, inside your own positioned card with a kit-deco positioning rule:

<div style={{ position: 'relative', overflow: 'hidden', color: 'var(--sky-ink)' }}>
  <Deco kind="star" />
  …
</div>

Where it appears

  • Brand › Home and Analytics › the four KPI tiles (Sales blob, Orders star, Commission blob, ROI star).
  • Brand › Home › hero wallet card.
  • PR Portal › Home › KPI cards (KpiCard).
  • Screens: Home, Analytics, PR · Home.

Guidelines

Do

  • Alternate blob and star across a row of tiles.
  • Let the host place it; it relies on the host's position: relative; overflow: hidden.

Don't

  • Don't give it meaning (status, trend); it is decoration.
  • Don't raise its opacity: text sits on top.

RTL and Arabic

  • Positioned with inset-inline-end, so it moves to the left corner in Arabic. The shapes are symmetric enough not to need flipping.

Tokens

None. The shape fills with currentColor, so it takes whatever ink its host sets (a Tile's tone ink, the hero's white).

Accessibility

  • aria-hidden="true" and focusable="false"; never announced or focused.
  • Low opacity keeps the text above it at full contrast.

Found in the source

  • ARIA attributes set: aria-hidden.

Read from the component's source and tests. See Accessibility for the patterns the library follows.

See also: Avatar · AvatarStack · Button · ButtonLink

Source

src/kit/primitives/Deco.tsx (line 11) on GitHub.

On this page