ProductCell
The v3 Analytics product cell (tbl('prod'), the product drawer's head): the product's picture (44px, radius 12), its name in bold and a muted "412 sold · EP-012" line. The product counterpart of CreatorCell: the same .person layout (gap 10, ellipsis on the name), so a products table lines up with a creators table beside it.
import { ProductCell } from '@ergasti/bricks';Examples
Product cell
The product counterpart of CreatorCell: a 44px picture (initials on a soft tone while there is none), the name in bold and a muted "412 sold · EP-012" line. seed picks the tone.
Code
import { ProductCell } from '@ergasti/bricks';
function Cell() {
return (
<div style={{ display: 'grid', gap: 16, maxWidth: 360 }}>
<ProductCell name="Velvet Matte Lipstick" sku="GL-LIP-014" sold={412} seed={3} />
<ProductCell name="Hydra Glow Serum" sku="GL-SER-002" sold={96} seed={1} />
<ProductCell name="Travel mirror" sku={null} sold={null} seed={5} />
</div>
);
}In a table
primary makes it the card's head under 860px, with no column label.
Code
import { DataTable, ProductCell, type DataColumn } from '@ergasti/bricks';
interface Product { id: number; name: string; sku: string; sold: number; stock: number }
const products: Product[] = [
{ id: 1, name: 'Velvet Matte Lipstick', sku: 'GL-LIP-014', sold: 412, stock: 38 },
{ id: 2, name: 'Hydra Glow Serum', sku: 'GL-SER-002', sold: 96, stock: 210 },
{ id: 3, name: 'Rose Water Mist', sku: 'GL-MST-007', sold: 1204, stock: 12 },
];
function InATable() {
const columns: DataColumn<Product>[] = [
{ key: 'product', label: 'Product', primary: true, render: (p) => <ProductCell name={p.name} sku={p.sku} sold={p.sold} seed={p.id} /> },
{ key: 'stock', label: 'In stock', align: 'end', tone: 'muted', render: (p) => p.stock },
];
return <DataTable label="Products" columns={columns} rows={products} rowKey={(p) => p.id} />;
}With a picture
src is the store's picture; if it fails to load the initials show instead.
Code
import { ProductCell } from '@ergasti/bricks';
function Picture() {
return (
<div style={{ display: 'grid', gap: 16, maxWidth: 360 }}>
<ProductCell name="Hydra Glow Serum" sku="GL-SER-002" sold={96} src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 44'%3E%3Crect width='44' height='44' fill='%23F7D6DF'/%3E%3Crect x='17' y='8' width='10' height='28' rx='4' fill='%23C7325C'/%3E%3C/svg%3E" />
<ProductCell name="Broken picture" sku="GL-X-000" src="https://invalid.example/missing.png" seed={2} />
</div>
);
}Props
Prop
Type
Labels
Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key productCell, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
sold | {n} sold | اتباع {n} |
Design guidance
How the BRICKS design system uses ProductCell. Written in docs/content/components/ProductCell.md; the props above are read from the code, which wins where the two disagree.
A product's table cell: its picture (or initials), its name in bold and a muted "412 sold · EP-012" line; use it as the primary column of any products table.
It is the v3 Analytics product cell (tbl('prod'), "Best-selling products") and the head of the product drawer. It is the product counterpart of CreatorCell: the same .kit-person layout (gap 10, ellipsis on the name), so a products table lines up with a creators table beside it.
Anatomy
- Thumb (
ProductThumb,.kit-thumb): 44px, radius 12,--softfill with the product's initials in a tone ink picked byseed; the store's picture covers it whensrcloads. Decorative (aria-hidden). - Name (
.kit-person-t > b): bold, one line, ellipsis,dir="auto". - Sub line (
.kit-psub, 12px,--ink-3): "412 sold", a hidden-from-AT "·", then the SKU isolated LTR (<bdi dir="ltr">).
Variants
| Props | Look | Use when |
|---|---|---|
sold + sku | "412 sold · EP-012" | The Analytics table (the mock). |
sold only | "412 sold" | The store has no SKU. |
sku only | "EP-012" | Catalogue lists without sales. |
| neither | Name alone, vertically centred | A picker or a plain list (story NameOnly). |
src | Photo instead of initials | The store sent a product image. |
seed | Initials' tone ink (cycles through the tone palette) | Pass the product's id or index so tones vary down the table. |
States
| State | How |
|---|---|
| Default | Name, sold and SKU. |
| No picture / broken picture | src missing or failing to load: the initials stay (the failed URL is dropped). |
| Long name | Truncates with an ellipsis on one line; the cell never wraps the table row. |
| Zero sold | sold={0} prints "0 sold"; null/omitted prints nothing. |
It is not interactive; make the row clickable (DataTable onRowClick) to open the product drawer.
Usage
<ProductCell name="Eyeshadow palette" sku="EP-012" sold={412} seed={0} />// Analytics › Best-selling products: ProductCell as the primary column, sales with the trend under it
const columns: DataColumn<Product>[] = [
{ key: 'name', label: 'Product', primary: true, sortKey: 'name', sortFirst: 'asc',
render: (p) => <ProductCell name={p.name} sku={p.sku} sold={p.sold} src={p.imageUrl} seed={p.id} /> },
{ key: 'sales', label: 'Sales', sortKey: 'sales', align: 'end', figure: 'product_sales',
render: (p) => <><b><Money value={p.sales} compact /></b><div><Delta value={p.trend} /></div></> },
];
<Card>
<Card.Header title="Best-selling products" />
<DataTable label="Best-selling products" rows={products} columns={columns} rowKey={(p) => p.id} sort={sort} onSort={setSort} onRowClick={openProduct} />
</Card>Where it appears
- Brand › Analytics › "Best-selling products" table (primary column).
- Brand › Analytics › product drawer head.
- Dashboard screen: Analytics (
gallery/screens/AnalyticsScreen.tsx).
Guidelines
Do
- Pass
seedfrom the product's id so the initials' tones stay stable between renders and pages. - Keep the SKU as the store writes it; it is shown LTR even in Arabic.
- Put sales figures in their own end-aligned column, not in the sub line.
Don't
- Don't add a link or button inside the cell; make the row the target.
- Don't pass a pre-formatted "412 sold" string as
sku:soldformats the number and the words. - Don't use it for people: use
CreatorCell.
RTL and Arabic
- The thumb sits on the right in Arabic; the sub line mirrors.
- "sold" becomes "اتباع 412"; the SKU stays LTR in a
<bdi>. - Numbers use the provider language's grouping (
count).
Tokens
.kit-psub (--ink-3, 12px), .kit-thumb (--soft, radius 12, the tone ink vars picked by seed), .kit-person (gap 10).
Accessibility
- The thumb is
aria-hidden; the name is the accessible text. - The "·" separator is
aria-hidden, so a screen reader reads "412 sold EP-012". - The name uses
dir="auto", so mixed-script names read correctly; it is truncated visually only, the full name stays in the DOM (add atitleon the row if needed).
Found in the source
- ARIA attributes set:
aria-hidden. - Its tests cover: “speaks Arabic from the provider, keeps the SKU LTR, and takes labels from the provider or its own prop”; “inside a clickable DataTable row, the row opens with Enter (the cell holds no control)”.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
CreatorCell: the same layout for a creator.ProductThumb: the picture alone (e.g. insideRowItems).RankMedal/HBars: other ways Analytics ranks products.
See also: useLanguage · DataTable
Source
src/blocks/products/ProductCell.tsx (line 42) on GitHub.