Skip to Content
BBRICKSv0.7.4
KitLists and tables

MainCell

The main cell: avatar + name (a link-button when it opens something) + a muted hint.

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

Examples

Main cell and copy link

The first cell of an older table row (a name, a hint, an optional button to open it), and the small "copy link" control.

Code
import { CopyLink, MainCell } from '@ergasti/bricks';

function Cells() {
  return (
    <div style={{ display: 'flex', gap: 24, alignItems: 'center', flexWrap: 'wrap' }}>
      <MainCell id={1} name="Laila Saeed" hint="201 orders" onOpen={() => {}} />
      <CopyLink url="https://trndr.app/join/hushup" />
    </div>
  );
}

Props

Prop

Type

Design guidance

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

The 0.1.x "main" table cell: an avatar, the person's name (a link-button when it opens something) and a muted hint line; use it for the first column of older console tables.

MainCell puts an Avatar (seeded by id) beside a column with the bold name and a hint ("MARI0327 · 13 orders"). With onOpen the name is a kit-lnk button that opens the record; without it the name is plain bold text with ellipsis. v3 tables use CreatorCell / PersonCell, which add handle links, tiers and photos.

Anatomy

  1. Row (span.kit-main): flex, 10px gap, min-width: 0.
  2. Avatar: md (38px), initials, tone from id.
  3. Name: button (kit-lnk) or span.kit-main-n (700, ellipsis).
  4. Hint (.kit-sub, optional).

Variants

PropLookWhen
onOpen setName is a link-buttonThe row opens a drawer
no onOpenPlain bold nameRead-only

States

StateTriggerLook
Hover (button)pointerAccent-dark underline
Focus-visibleTabShared focus ring
Long nameoverflowEllipsis

Usage

interface Creator { id: number; name: string; coupon: string; orders: number }
const columns: Column<Creator>[] = [
  { id: 'creator', header: 'Creator', type: 'main', cell: (c) =>
    <MainCell id={c.id} name={c.name} hint={`${c.coupon} · ${c.orders} orders`} onOpen={() => console.log('open', c.id)} /> },
];

Where it appears

Guidelines

Do

  • Use onOpen rather than making the whole cell clickable.

Don't

RTL and Arabic

  • Avatar at the inline start; names with Arabic initials handled by Avatar.

Tokens

Avatar tone tokens; --color-text-primary, --color-accent-dark.

Accessibility

  • The avatar is hidden; the name is the text. As a button, Enter/Space open.

Found in the source

  • ARIA attributes set: aria-label, aria-live.
  • Its tests cover: “uses ARIA table roles with a labelled table and column headers”; “Enter on a row opens its drawer and keeps it open (Z2 QA: the Enter fell through to the drawer\”; “gives every cell its column label for the < 860px card layout”.

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

See also: CopyLink · BulkBar · DataTable

Source

src/kit/Table.tsx (line 8) on GitHub.

On this page