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
- Row (
span.kit-main): flex, 10px gap,min-width: 0. - Avatar: md (38px), initials, tone from
id. - Name: button (
kit-lnk) orspan.kit-main-n(700, ellipsis). - Hint (
.kit-sub, optional).
Variants
| Prop | Look | When |
|---|---|---|
onOpen set | Name is a link-button | The row opens a drawer |
no onOpen | Plain bold name | Read-only |
States
| State | Trigger | Look |
|---|---|---|
| Hover (button) | pointer | Accent-dark underline |
| Focus-visible | Tab | Shared focus ring |
| Long name | overflow | Ellipsis |
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
- 0.1.x console tables. v3 Brand and PR tables use
CreatorCell/PersonCell. - Kit gallery.
Guidelines
Do
- Use
onOpenrather than making the whole cell clickable.
Don't
- Don't use it on v3 screens; use
CreatorCell.
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.
Related
CreatorCell,PersonCell: v3 cells.Avatar.
See also: CopyLink · BulkBar · DataTable
Source
src/kit/Table.tsx (line 8) on GitHub.