Bruno DelorenceBruno
Appearance
Appearance

Choose your reading theme.

Contact

Sheet fill

New

A prompt fills an empty spreadsheet: skeleton rows breathe, then an aurora climbs the sheet and the rows resolve under it from blurred to sharp.

sheet-fill/sheet-fill.tsx
Live · interactive
AccountDeal sizeStage

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

  • An assistant filling a table from a prompt, when the wait is a few seconds and the result lands all at once or row by row.
  • A first fill of an empty sheet, the moment that shows what the assistant did to the whole grid.
  • Generated data the reader will check cell by cell afterwards: the result is an ordinary table with headers, and it can be stopped halfway.

When not to use

  • Refreshing a few cells of a sheet in daily use. The sweep covers the whole grid; mark the changed cells instead.
  • A run that takes minutes. Skeletons that breathe for that long say nothing; show progress with a count.
  • A sheet where people edit while it fills. Here the prompt locks and the cells are read-only for the length of a run.
  • Tables wider than a phone without a reason. Past about four columns the sheet scrolls sideways under the card.

The sequence

  • 0 s: Generate becomes Stop in 0.2 s and the prompt locks. A skeleton row arrives every 120 ms.
  • 1.73 s: the aurora rises from behind the card at 1.05 sheet heights a second, about 600 px.
  • 2.1 s: the bottom row starts to resolve when the band’s middle reaches it. Each row takes 0.38 s, from a 4 px blur and about 3.5% spread apart.
  • 2.55 s: the top row starts. Past it, Stop has nothing left to stop and the button becomes Clear.
  • 3.03 s: the last of the colour has cleared and only the table is left.

What Stop keeps

  • While rows arrive: the rows that came stay and fade in over 0.24 s; the others never appear. If none came, the sheet is empty again.
  • During the sweep: rows the band reached stay and finish resolving, the others’ bars fade out, and the band dissolves in 0.24 s.
  • After either: onStop gets the rows kept, and the button says Clear.

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

The words are the prompt, the column labels, the cell values and the button.

  • The prompt names the rows and the columns it expects, in the reader’s words.
  • Column labels are short nouns in sentence case: Deal size, not DEAL SIZE ($).
  • Figures carry their unit in the cell ($94,200), and all use the same format.
  • The button is a verb for what happens next: Generate, Stop, Clear.

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

Into components/sheet-fill of any React project, with no setup:

Terminal
npx shadcn@latest add https://brunodelorence.com/r/sheet-fill.json

Either way it needs React 19.2 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

deals-sheet.tsx
import { SheetFill, type SheetColumn } from './sheet-fill';const columns: SheetColumn[] = [  { key: 'account', label: 'Account', width: 170 },  { key: 'size', label: 'Deal size', kind: 'number', width: 100 },  {    key: 'stage',    label: 'Stage',    kind: 'pill',    width: 110,    tones: { Won: 'green', Proposal: 'amber' },  },];async function* fetchDeals(prompt: string, signal: AbortSignal) {  const response = await fetch('/api/fill', { method: 'POST', body: prompt, signal });  for (const row of await response.json()) yield row;}export function DealsSheet() {  return (    <SheetFill      columns={columns}      stream={fetchDeals}      defaultPrompt="List our largest deals this quarter."      onStop={(kept) => console.log('kept', kept.length)}      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.

An empty spreadsheet with a prompt card floating over its foot. Generate becomes Stop with a spinner while skeleton bars arrive row by row. Then an iridescent band climbs the sheet from behind the card, peach and magenta to lavender, aqua and mint, and the rows resolve under it from the bottom up: blurred and slightly spread apart, then sharp and in place, with figures and coloured stage pills. The result is a plain table with headers. Stop really interrupts, keeping the rows already delivered; Clear empties the sheet.

  • One clock from the press, timed: Stop in 0.2 s, a skeleton row every 120 ms, the sweep at 1.73 s, 1.3 s of colour, and the button turning to Clear when the top row has started.
  • Each colour belongs to a height on the sheet, from mint and aqua at the top through blue, lavender and magenta to peach and yellow at the foot, and stays there; what climbs is a soft window that reveals them, at 1.05 sheet heights a second, so the band changes hue as it rises. The sides lag, making a dome, and the hues slant warmer to the left. A pale pink tail clears last.
  • A translated gradient cannot change hue with height, and moving a mask repaints a full-size layer each frame, so the colours are computed per pixel on a 64 px wide canvas stretched over the sheet: one layer of about 25 KB, painted only during the sweep. It covers the rows at 0.72 strength (0.52 in the dark scheme), with plain alpha, so dark text takes the band’s colour.
  • A row starts when the band’s middle reaches its height, so the bottom row starts first and the top one about 0.4 s later. It takes 0.38 s: fading in over the first 45%, and settling from about 3.5% spread apart around a point two thirds down the rows. Each cell is up to 24 ms off the others, so a row does not resolve as a flat strip.
  • The blur goes from 4 px to none in five steps, so each cell repaints five times; the animations are removed as they finish and no filter stays on the rows.
  • Skeleton bars grow in from their text side in 0.24 s and breathe from 100% to 53% opacity every 1.4 s, each row 40 ms after the one above.
  • The stream prop takes a function returning an async iterable: a skeleton shows per row received, the sweep follows when it ends, and Stop aborts its signal.
  • While on screen and untouched, a demo presses Generate and later Clear; any input from the reader stops it. Every colour is a token on the root with light-dark(); the script reads the aurora’s strength and scheme from a colour on the canvas at the start of each sweep.
PropTypeDefaultDescription
columns{ key: string; label: string; kind?: 'text' | 'number' | 'pill'; width?: number; tones?: Record<string, Tone> }[]Account, Deal size, StageThe columns, in order. width is its px at full size and sets the sheet’s width; tones gives a pill value blue, grey, amber or green.
rowsRecord<string, string>[]nine sample dealsThe rows a timed run delivers one by one. Ignored when stream is given.
stream(prompt: string, signal: AbortSignal) => AsyncIterable<SheetRow>—Real rows as they arrive: the sweep plays when it ends; Stop aborts the signal.
promptstring—The prompt, if you hold it; pair it with onPromptChange.
defaultPromptstringa request for nine dealsThe prompt it starts with, when it holds it itself.
onPromptChange(prompt: string) => void—Called as the prompt is edited.
onGenerate(prompt: string) => void—Called when a run starts.
onStop(kept: SheetRow[]) => void—Called on Stop, with the rows it kept.
onClear() => void—Called when the sheet is emptied.
onAttach(files: File[]) => void—Called with what the + button picked; the name shows as a chip on the card.
minRowsnumber17How many rows the empty grid shows at least.
defaultPhase'empty' | 'loading' | 'aurora' | 'filled' | 'stopped''empty'Where it starts. All but empty are stills for docs and turn the demo off.
autoplaybooleantrueWhile on screen and untouched, a demo generates and clears in a loop; never under reduced motion.
colorScheme'light' | 'dark' | 'system'—Forces a scheme. Left out, it follows the page.
classNamestring—Added to the root.

Focus and keyboard

  • Generate, Stop and Clear are one button, so the focus stays on it through a run.
  • Cmd or Ctrl and Enter in the prompt starts a run. Escape anywhere in the component stops one.
  • The sheet is a focusable region, so it can be scrolled by keyboard when rows run past the card.
  • Every control shows a 2 px focus ring on keyboard focus.

Screen readers

  • A polite live region announces “Generating rows.”, “Sheet filled: 9 rows.”, “Stopped. 4 rows kept.” and “Sheet cleared.”.
  • The grid is a table with th scope="col" headers and th scope="row" numbers. aria-busy is on during a run, and the empty rows are hidden.
  • Values in a skeleton row are hidden until they resolve. The canvas and the demo pointer are hidden.

Colour

The pills’ text is darker than a pale pastel would be, at about 4.5:1 on its own fill, so stage names stay readable at 13 px. The tone is never the only cue: each pill also says its value.

Motion

With reduced motion there is no aurora, no blur and no breathing: static bars, then the rows fade in over 0.24 s when they are all there. The spinner slows to 2.4 s a turn. The demo does not play.

In this build

  • The grid is a real table: th scope="col" headers, a th scope="row" number per filled row, aria-busy during a run. The empty rows, the canvas and the demo pointer are hidden from screen readers.
  • A polite live region announces the start, the completion with the row count, a stop with the rows kept, and a clear.
  • Generate, Stop and Clear are one button, so the focus stays on it. Cmd or Ctrl and Enter in the prompt starts a run, and Escape stops one. The prompt is a real textarea, locked during a run.
  • Under reduced motion there is no aurora, blur or breathing: static bars, then a 0.24 s fade of the rows, and the demo does not play.

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

sheet-fill.tsx
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import {  useEffect,  useEffectEvent,  useRef,  useState,  type ChangeEvent,  type CSSProperties,  type KeyboardEvent,} from 'react';import { createAurora, reachedAt, SWEEP_SECONDS, type Aurora } from './aurora';import {  DEFAULT_COLUMNS,  DEFAULT_PROMPT,  DEFAULT_ROWS,  type SheetColumn,  type SheetRow,} from './data';import { DemoPointer, runDemo, type Point } from './demo-pointer';import { useAutoplay } from './use-autoplay';import styles from './sheet-fill.module.css';
sheet-fill.module.css
/* Sheet fill (sheet-fill.tsx): a spreadsheet running off the top of a grey stage, with a prompt card   floating over its foot.   Sizes at full width: a 416 px sheet with a 34 px bottom radius, 32 px rows, a 38 px column of row   numbers, 10 px skeleton bars, a 390 px card with a 28 px radius and 13 px sides, a 36 px + button,   a 38 px action button (96 px as Generate, 89 as Stop, 70 as Clear), 24 px pills.   Layers: the sheet and its table (1), the aurora over them (2), the card (3), the demo pointer (4).   The aurora covers the sheet to its very foot, so its colour shows around the card.   Colours are the tokens below, light-dark(light, dark) where the two differ. */.root {  --stage: #f3f3f3;  --sheet: #fdfdfd;  --sheet-edge: #ebebec;  --grid: #efeff0;  --gutter: #f9f9f9;  --number: #8e8e94;  --ink: #26262a;  --ink-soft: #6c6c73;  --bar: #eeeeef;  --card: #fdfdfd;  --card-edge: rgb(0 0 0 / 0.07);
aurora.ts
// Copyright (c) 2026 Bruno Delorence. MIT License./* * The aurora: a band of colour that climbs the sheet and dissolves. Each colour belongs to a height * on the sheet (aqua and mint at the top, then blue, lavender, magenta, peach and a yellow at the * foot) and stays there; what travels is a soft window that reveals them, so the band changes hue * as it climbs. One translated gradient can't draw that, and moving a mask repaints a full-size * layer each frame, so the colours are worked out per pixel on a 64 px wide canvas that the * stylesheet stretches over the sheet. The colours are soft enough not to show the stretch, and * the whole effect costs one layer of about 25 KB, painted only for the 1.3 s it runs. * * Times are seconds from the start of the sweep; heights are shares of the sheet, 0 at its top. *//** How long a sweep paints, in seconds. */export const SWEEP_SECONDS = 1.3;/** The band's middle starts at 78% of the height, 0.15 s in, and climbs 1.05 heights a second. */const FRONT_START = 0.78;const FRONT_AT = 0.15;const FRONT_SPEED = 1.05;/** When the band's middle reaches height `v`: a row resolves from there. */export const reachedAt = (v: number) => FRONT_AT + (FRONT_START - v) / FRONT_SPEED;
data.ts
// Copyright (c) 2026 Bruno Delorence. MIT License./* * The sheet's shape and its default content: a column says how its cells are drawn, a row is a * plain record keyed by the columns. */export type Tone = 'blue' | 'grey' | 'amber' | 'green';export type SheetColumn = {  key: string;  label: string;  /** Plain text, right-aligned tabular figures, or a coloured pill. */  kind?: 'text' | 'number' | 'pill';  /** Its width in px at full size; narrow screens shrink all of them in proportion. */  width?: number;  /** For a pill: the tone of each value. A value not listed is grey. */  tones?: Record<string, Tone>;};export type SheetRow = Record<string, string>;export const DEFAULT_COLUMNS: SheetColumn[] = [  { key: 'account', label: 'Account', width: 163 },
use-autoplay.ts
// Copyright (c) 2026 Bruno Delorence. MIT License.'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()` hands it to the * reader for good (until the component mounts again), so it can't come back on its own. */export function useAutoplay<T extends HTMLElement>() {  const ref = useRef<T>(null);  const [visible, setVisible] = useState(false);  const [reduced, setReduced] = useState(true);  const [taken, setTaken] = useState(false);  useEffect(() => {    const element = ref.current;    if (!element) return;    let onScreen = false;    const update = () => setVisible(onScreen && !document.hidden);    const observer = new IntersectionObserver(      ([entry]) => {
demo-pointer.tsx
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import type { CSSProperties, Ref } from 'react';/* * The demo's pointer, and the steps that move it. A demo is a script of awaited steps: wait, or * glide the pointer somewhere. Stopping the demo (the reader takes over, or it scrolls away) ends * the step in progress at once: its promise rejects, which ends the script right there, and the * pointer fades out. * * Each glide is a curved flight played by the Web Animations API, so nothing runs frame by frame. * The points of the flight are handed to whoever wants to move along with it (nothing here uses * them yet). The arrow and the hand are HTML boxes * that swap by their visibility: a change of style inside an SVG would lay the SVG out again. */export type Point = { x: number; y: number };/** A glide's path and timing, for an animation that plays along with it. */export type Flight = { points: Point[]; timing: KeyframeAnimationOptions };export type Demo = {