Bruno DelorenceBruno
Appearance
Appearance

Choose your reading theme.

Contact

Records table

A CRM grid of companies with coloured category tags, sortable columns and an agent that fills a new column row by row.

records-table/records-table.tsx
Live · interactive
Companies
Company
B2B, Gelato, Wholesale
4 days agoVery strongalpine-churn.example.com
Amber Scoop — Prague
Gelato, B2B
over 1 year agoNo communication—
Andes Snow Creamery — Quito
Gelato, Catering
almost 2 years agoVery weak—
Sorbet, Imports
11 months agoVery weakapricot-atlas.example.com
Gelato, Seasonal
9 days agoVery strongaurora-scoops.example.com
Dairy-free, Seasonal, B2C
5 weeks agoWeakbaltic-berry.example.com
Vegan, Cafe, B2C
9 days agoVery strongblack-sesame.example.com
Gelato, Cafe
over 1 year agoVery weakblue-fig.example.com
Dairy-free, Local, Seasonal
8 days agoVery strongboreal-batch.example.com
B2B, Local, Wholesale
about 2 years agoNo communicationcacao-norte.example.com
Wholesale, Imports
over 1 year agoVery weakcape-vanilla.example.com
Cafe, Local, Seasonal
6 days agoVery strongcedar-spoon.example.com
Dairy-free, Seasonal
No contactNo communicationcloudberry-cone.example.com
Vegan, B2C, Cafe
24 days agoWeakcoconut-commons.example.com
Gelato, Cafe, B2C
about 1 month agoWeakcopper-cone.example.com
Sorbet, Local
9 days agoVery strongcoral-coast.example.com
Gelato, Wholesale, Catering
2 months agoWeakcrimson-clover.example.com
B2B, Wholesale, Local
2 days agoVery strongdelta-dairy.example.com
Gelato, Wholesale
3 days agoVery strongdolomite-dairy.example.com
Dragonfruit Dock — Shenzhen
Sorbet, B2B, Wholesale
No contactNo communication—
B2C, Vegan
15 days agoWeakember-cone.example.com
B2B, Catering, Local
10 months agoVery weakequator-cream.example.com
Fjord Fizz Ice — Oslo
Dairy-free, Seasonal
No contactNo communication—
Seasonal, Local, Catering
7 weeks agoWeakglacier-grove.example.com
Sorbet, Cafe
6 weeks agoWeakhibiscus-house.example.com
Juniper & Cream — Vancouver
Dairy-free, Catering
No contactNo communication—
B2C, Cafe, Vegan
3 weeks agoVery strongkumo-creamery.example.com
Gelato, Seasonal, Catering
7 days agoVery stronglagoon-ladle.example.com
Lotus Leaf Scoops — Hanoi
Vegan, Cafe
15 days agoWeak—
Dairy-free, Cafe
8 months agoWeaklumen-soft-serve.example.com
Sorbet, Vegan
almost 2 years agoVery weakmango-moon.example.com
B2B, Wholesale, Seasonal
15 days agoWeakmaple-orbit.example.com
Midnight Milk — Tromsø
Dairy-free, Vegan, Wholesale
No contactNo communication—
Mint Medina — Tunis
Dairy-free, Vegan, Local
No contactNo communication—
Sorbet, Vegan, Catering
18 days agoWeakmonsoon-mango.example.com
B2B, Wholesale
about 1 month agoVery weakmooncake-ice-cream.example.com
Imports, B2B
almost 2 years agoNo communicationnomad-nougat.example.com
Gelato, Cafe, Local
4 days agoVery strongolive-snow.example.com
Gelato, Seasonal, Cafe
5 days agoVery strongorchard-cloud.example.com
Sorbet, Seasonal
2 months agoWeakpacific-pear.example.com
B2C, Vegan
3 months agoVery weakpalm-sugar.example.com
B2C, Local
12 months agoVery weakpampa-creamery.example.com
Pine & Pistachio — Istanbul
Gelato, Catering
about 1 month agoVery weak—
B2C, Wholesale
10 days agoVery strongquartz-cone.example.com
Cafe, Vegan
about 1 month agoWeakred-lantern.example.com
Rosewater Kulfi — Jaipur
B2C, Seasonal
2 months agoVery weak—
Imports, Catering
almost 2 years agoVery weaksaffron-sky.example.com
Sahara Swirl — Marrakech
Sorbet, Local
5 months agoVery weak—
Imports, Catering, Gelato
8 months agoVery weaksalt-and-silk.example.com
Sorbet, Imports
about 1 month agoWeaksilk-road.example.com
Gelato, Local
2 months agoWeaksol-y-nieve.example.com
Gelato, Cafe
over 2 years agoNo communicationsunbird.example.com
Vegan, Sorbet, B2C
9 months agoVery weaktamarind-tide.example.com
Gelato, Local
2 months agoWeaktasman-sea.example.com
Sorbet, Local, B2C
6 days agoVery strongtropic-churn.example.com
B2B, Wholesale, Cafe
5 weeks agoWeakumber-cream.example.com
Vanilla Vale — Antananarivo
Imports, Local
No contactNo communication—
Dairy-free, Vegan, Cafe
3 days agoVery strongwillow-whip.example.com
Sorbet, Cafe, Seasonal
11 days agoVery strongyuzu-yard.example.com
Gelato, Seasonal
3 weeks agoWeakzenith-gelato.example.com
60count—55% average48 links

The live component, numbered part by part. Every measurement is read from it as it is drawn. Point at a row to outline its part, or at a part to find its row.

The choices it offers, each value drawn live and the default marked, with how to pick one.

When to use

  • A list of records with several properties each, read across a row: companies, people, deals.
  • Columns filled by an agent or a rule, where each header says how and can fill its column again.
  • Picking a few records to act on together: ticked rows, a header box that selects them all.
  • Reading the same list by different orders, recent or strong first, without losing the original one.
  • Wide data in a small card or side panel: one scroller both ways, the company column and the header kept in view.

When not to use

  • A handful of records with two or three facts each. Use a list or cards.
  • Editing cell by cell like a spreadsheet: this table reads and calculates, it has no cell editor.
  • Hundreds of rows or more: every row is drawn. Page it, or use a virtualised grid.
  • Comparing numbers at a glance. Use a chart, and keep the table for the detail.
  • A table on a phone as the main view: a column at a time fits better as a list of cards.

Columns an agent fills

  • Every column but the company is filled by an agent, and its header says how: the type, the tool, the columns it reads and a prompt, with those columns as chips.
  • Go calculate fills the column again, a row every 120 ms in the order shown. Each row waiting says Calculating… beside a breathing dot.
  • The component draws the run; the agent is yours. onCalculate gets the column’s name, so start the real work from there.
  • The + adds a column of the type picked and opens its settings at once. It can be pinned first, after the company, or hidden again.

Selecting and sorting

  • Tick rows to act on them together. The header’s box selects them all, or clears them, and shows a dash when only some are ticked. onSelectionChange gets their ids, or their names when they have none.
  • Two columns sort: Last interaction and Connection strength. The first press puts the most recent or strongest first, the second turns it over, the third restores the book’s order.
  • Rows without a value stay last either way, so a sort never opens on empty rows.
  • Clear selection is in Table options, beside Compact columns and Reset column widths.

Width and folding tags

  • A 480 px card, 440 px tall, onto one scroller that moves both ways. The header, the company column and the footer stay in view.
  • Under 440 px the company column starts at half the card (150 px at least), so the other columns still show.
  • Tags that don’t fit whole fold into a +N chip as the column narrows. The cell’s title lists them all on hover, and screen readers hear them all.

Each one drawn with the component itself, used well or badly.

The records bring the words; the column names, the strength labels and the prompts are the component’s own.

  • Company names as people know them, with the city after them: Alpine Churn — Zürich. A long one is cut with an ellipsis and shown whole in its title.
  • Categories: a short noun each, the same spelling on every row, so the column and its unique count stay true.
  • Last interaction as [days, label]: the number sorts, the label shows (4 days ago). Leave it out when there was no contact; the cell says No contact.
  • Strength is one of five values, shown as Very strong, Strong, Weak, Very weak and No communication.
  • Sites without the scheme: alpine-churn.example.com. They show in Links and link the name, opening in a new tab.
  • label names the table for screen readers, as a plural noun: Companies, Accounts.

You can add this component with the shadcn CLI or by hand:

Into components/records-table of any React project, with no setup:

Terminal
npx shadcn@latest add https://brunodelorence.com/r/records-table.json

Either way it needs React 19 and a bundler that supports CSS Modules, such as Next.js or Vite. It has a dark colour scheme: it follows your page’s color-scheme, light unless the page sets one, or its colorScheme prop, with nothing to configure. Browsers without light-dark() show it light.

Usage

accounts.tsx
import { RecordsTable, type CompanyRecord } from './records-table';const companies: CompanyRecord[] = [  {    name: 'Harbor Freeze',    city: 'Lisbon',    site: 'harbor-freeze.example.com',    categories: ['Gelato', 'Wholesale'],    last: [3, '3 days ago'],    strength: 'very-strong',  },  {    name: 'Pine Cone Dairy',    city: 'Oslo',    categories: ['Local'],    strength: 'none',  },];export function Accounts({ onPick }: { onPick: (ids: string[]) => void }) {  return (    <RecordsTable      records={companies}      categoryColors={{ Gelato: 'oklch(0.62 0.18 293)', Wholesale: 'oklch(0.76 0.13 70)', Local: 'oklch(0.7 0.13 162)' }}      onSelectionChange={onPick}      autoplay={false}    />  );}

Each state below is a live instance, locked so you can study it.

The pieces it is built from, each with its measurements read live.

A grid of sixty companies that scrolls both ways under a sticky header, company column and footer of calculations. Rows tick and tint, two columns sort, every column’s edge drags, and tags that no longer fit fold into a +N chip. Each column’s header opens how an agent fills it — type, tool, inputs and a prompt with chips — and the + adds a Competitors column that the agent fills a row every 120 ms.

  • One scroller holds a fixed-layout table. Its header sticks to the top, the footer of calculations to the bottom and the company column to the left, each painted opaque, with a faint 5 px shadow off the company column’s edge; the corner cells sit above both.
  • A row’s number and its checkbox share one 24 px grid cell: the number gives way to the box under the pointer, in focus or once ticked. Ticked rows mix 7 % of the accent into the card in srgb; the header’s box selects all and shows a dash for some (and is indeterminate for screen readers).
  • Tags take one base colour per category and mix it into the card in srgb: 34 % at night with its words 86 % of it on white, 18 % by day with a 32 % edge and words darkened by the ink. Each tag and +N chip is measured once, hidden (again when the fonts arrive), so a cell shows as many tags as fit whole, with a chip for the rest, without measuring 60 rows.
  • Every column’s right edge is a separator: drag it (with pointer capture) or focus it and press the arrows, from 120 to 520 px, and a 2 px accent bar shows while it is in use. Table options compact the columns, so the tags fold, or put them back.
  • Last interaction and Connection strength sort: the arrow fades in on the header’s hover and stays while it sorts, turns over in 160 ms for the other way, and a third press restores the book’s order. Rows without a value stay last either way.
  • A header opens its column’s settings under it, tinting the column with 8 % of the accent and an accent line along its top. Type, Tool and Inputs open small menus beside the panel (or over it when the component is too narrow); the prompt is a contentEditable line whose mentioned columns stand as chips, read back as the reader types.
  • Go calculate fills the column again: each waiting cell says “Calculating…” beside a dot breathing between 35 % and full (1.1 s), and one row fills every 120 ms in the order shown. The + adds a Competitors column, of the type picked, and opens its settings at once; it can be pinned first or hidden again.
  • Menus pop in from their button’s corner, 160 ms from 95 %, and are placed inside the component (clamped to its edges, following the grid as it scrolls). A soft highlight glides between their rows by top and height (220 ms).
  • While on screen and untouched, a demo uses the table: it ticks two rows, sorts by the last interaction both ways, adds and calculates the Competitors column, compacts the columns so the tags fold, resets them and tidies up. Its actions never reach the callbacks and are not announced; any real input hands the table to the reader.
  • Every colour is a light-dark() token on the root, so the table follows the page’s color-scheme or the colorScheme prop. On a card under 440 px the company column starts at half its width, so the others still show.
PropTypeDefaultDescription
recordsCompanyRecord[]sixty sample companiesThe companies, in the book’s order: { id?, name, city?, site?, categories, last?: [days, label], strength }. strength is very-strong, strong, weak, very-weak or none.
categoryColorsRecord<string, string>twelve sample categoriesEach category’s base colour, any CSS colour; the tags mix it with the table.
labelstring'Companies'Names the table and its scroller for screen readers.
defaultStateRecordsState—Opens in a state, with the demo off: selected rows, sort, compact widths, competitors (or 'pinned'), a column held calculating, unique counts, scroll (px or 'end') and an open menu or column panel, held until a press inside the table.
onSelectionChange(ids: string[]) => void—Called with the ids (or names) of the ticked rows when the reader changes them.
onSortChange(sort: RecordsSort) => void—Called when the reader sorts: { key: last | strength, direction }, or null for the book’s order.
onCalculate(column: string) => void—Called when the reader presses Go calculate, with the column’s name.
autoplaybooleantrueWhile on screen and untouched, a demo selects, sorts, adds and calculates a column, and folds the tags by itself.
colorScheme'light' | 'dark' | 'system'—Its colours: light, dark, or the reader’s system setting. Without it the component follows the page’s color-scheme, which is light unless the page sets one.
classNamestring—Extra class for the root.

Screen readers

  • A real table, with label as its caption, column headers and each company as its row’s header, inside a labelled scroll region.
  • Every row’s checkbox names its company (“Select Alpine Churn — Zürich”), and the header’s box is indeterminate when some rows are ticked. A polite status says how many are selected.
  • Sortable headers carry aria-sort, the sort button says the order it is in, and each new order is announced.
  • A column’s settings open as a dialog named after it; the + and the options open menus.
  • A categories cell reads out every tag, the folded ones too, from visually hidden text; the tags you see and the +N chip are hidden from assistive tech so nothing is read twice.

Keyboard

  • Tab reaches the scroll region, which the arrow keys scroll both ways, then every checkbox, header, sort button and column edge, even while a row number covers its box.
  • On a column edge, the left and right arrows resize by 10 px (40 with Shift); Home and End go to 120 and 520 px.
  • In a menu, the arrows, Home and End move between rows. Escape closes the innermost menu or panel and gives the focus back to its button.

Pointer

  • The sort arrow and every column edge take a 24 × 24 px press, larger than they look (WCAG 2.5.8, AA).
  • A column’s exact width needs a drag or the arrow keys. With one press, the options menu’s Compact columns and Reset column widths set every width at once (WCAG 2.5.7, AA, only in part).

Colour and motion

Colour is never alone (WCAG 1.4.1): every tag says its category and every strength dot sits beside its word. Every word is at least 4.5:1 against its surface in both schemes (WCAG 1.4.3, AA), the tags included with the default category colours, and the checkbox and switch edges at least 3:1 (WCAG 1.4.11, AA). Under reduced motion the menus appear at once, the calculating dot holds still and the demo never plays. Otherwise the pointer over it holds the demo, and the first press, key or wheel stops it for good (WCAG 2.2.2, A).

In this build

  • A real table with a caption, column headers and the company as each row’s header, inside a focusable, labelled scroll region that arrow keys scroll both ways.
  • Every row has a labelled checkbox (“Select Alpine Churn — Zürich”), reachable with Tab even while the row number covers it; the header’s box is indeterminate when some rows are ticked. A polite live region says how many are selected.
  • Sortable headers carry aria-sort, and the sort is a separate button (“Sort by Last interaction, now most recent first”); the order is announced. Column edges are separators with their width as a value: arrows resize by 10 px (Shift by 40), Home and End go to the limits.
  • Headers are buttons that open their column’s settings as a labelled dialog; the + and the options open menus with menuitem, menuitemradio and menuitemcheckbox roles. Arrow keys, Home and End move between rows, Escape closes the innermost menu and gives the focus back to its button, and a press outside closes them.
  • Under reduced motion the menus appear at once, the calculating dot holds still and the demo never plays. Focus rings are visible on every control.

The complete source behind this demo. Open source under the MIT license, © 2026 Bruno Delorence: copy it, change it, ship it.

records-table.tsx
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import {  useCallback,  useEffect,  useEffectEvent,  useLayoutEffect,  useMemo,  useRef,  useState,  type CSSProperties,  type KeyboardEvent as ReactKeyboardEvent,  type PointerEvent as ReactPointerEvent,} from 'react';import {  ColumnPanel,  PROPERTY_TYPES,  typeIcon,  type ColumnSettings,  type PropertyType,} from './column-panel';import { CATEGORY_COLORS, COMPANIES, COMPETITORS, type CompanyRecord, type Strength } from './data';
column-panel.tsx
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import { useEffect, useId, useRef, useState, type CSSProperties, type ReactNode } from 'react';import { GlideMenu, type MenuItem } from './glide-menu';import { Icon, type IconName } from './icons';import styles from './records-table.module.css';/* * A column's settings: how an agent fills it. Its type, the tool or model it uses, whether it checks * its answers against sources, which other columns it reads, and the prompt, where those columns * stand as small chips. Go calculate fills the column again; Pin moves it next to the company; a * column added from the table can be hidden again. * * - Type, Tool and Inputs open small menus beside the panel (or over it when there is no room), *   which pop in from their corner in 140 ms. * - The prompt is a contentEditable line: typed text and the chips of the columns it mentions. *   What the reader types is read back from it as they type; it is drawn afresh only when another *   column's settings come in. */export const PROPERTY_TYPES: { type: PropertyType; icon: IconName }[] = [  { type: 'Text', icon: 'text' },
glide-menu.tsx
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import {  useEffect,  useRef,  useState,  type CSSProperties,  type KeyboardEvent as ReactKeyboardEvent,  type ReactNode,} from 'react';import { Icon } from './icons';import styles from './records-table.module.css';/* * A short menu under a small heading. A soft highlight sits under the row the pointer or the focus * is on and glides to the next by its top and height (220 ms), fading out when both leave. Up and * down arrows, Home and End move the focus between the rows; Escape is the opener's to handle. */export type MenuItem = {  key: string;  label: string;
icons.tsx
// Copyright (c) 2026 Bruno Delorence. MIT License.import type { ReactNode } from 'react';/* * The table's line icons, drawn on a 24-unit grid with round ends, in the colour of the text around * them. Every one is decorative: the control it sits in carries the words. */export type IconName =  | 'text'  | 'file'  | 'collection'  | 'single'  | 'multi'  | 'url'  | 'reference'  | 'json'  | 'splitter'  | 'date'  | 'globe'  | 'cursor'  | 'sparkle'  | 'plus'
data.ts
// Copyright (c) 2026 Bruno Delorence. MIT License./* * The sample book: sixty ice-cream makers, sellers and cafés (invented, with example.com sites), the * colour of each category, and what the demo's "Competitors" column finds for them. *//** How strong a relationship is, from the last interaction. */export type Strength = 'very-strong' | 'strong' | 'weak' | 'very-weak' | 'none';export type CompanyRecord = {  /** Names the row in selections; the name is used when absent. */  id?: string;  name: string;  /** Shown after the name: “Alpine Churn — Zürich”. */  city?: string;  /** The company's website, without the scheme: “alpine-churn.example.com”. */  site?: string;  categories: string[];  /** When they last heard from you: days ago (for sorting) and how it reads. */  last?: [days: number, label: string];  strength: Strength;};
records-table.module.css
/* Records table (records-table.tsx): a soft grey stage with a 480 px card in its middle, the grid   of companies scrolling inside it both ways, or at night a graphite stage with the card a step   lighter.   Colours are the tokens below, light-dark(light, dark): the component takes the color-scheme it   inherits from the page (light unless the page says otherwise), or the one its colorScheme prop   sets (data-color-scheme). Tags, the selected rows and the selected column mix their colour into   the card's in srgb, so each scheme keeps its own strength of tint.   Memory. The grid is one scroller: the header, the company column and the footer stick to its   edges, painted opaque so nothing shows through. Motion is opacity and transforms (the menus'   pop-in, the sort arrow, the calculating dot) plus the menus' highlight gliding by top and height   within one short list. */.root {  /* The stage, the card, the hover and the footer's and prompt's inset. */  --canvas: oklch(96.1% 0.002 247.84);  --surface: oklch(100% 0 0);  --hover: oklch(97% 0.002 247.839);  --inset: oklch(97.9% 0.002 247.839);  --mark: oklch(96.1% 0.001 286.375);  /* Words: strong, quiet and faint. */  --ink: oklch(24.7% 0.006 258.361);  --ink-2: oklch(50.6% 0.01 264.477);
use-autoplay.ts
'use client';import { useCallback, useEffect, useRef, useState } from 'react';/* * When a demo may play on its own: while part of it is on screen and the tab is visible, never * under reduced motion, and never again once the reader has used it. `take()` (a press, a key or * the wheel) hands it to the reader for good, until the component remounts. `pause()` (the * pointer moving over it) only holds it, and it carries on `idle` ms after the pointer stops. */export function useAutoplay<T extends HTMLElement>(idle = 6000) {  const ref = useRef<T>(null);  const [visible, setVisible] = useState(false);  const [reduced, setReduced] = useState(true);  const [taken, setTaken] = useState(false);  const [paused, setPaused] = useState(false);  const timer = useRef(0);  useEffect(() => {    const element = ref.current;    if (!element) return;    let onScreen = false;    const update = () => setVisible(onScreen && !document.hidden);    const observer = new IntersectionObserver(