E-ink panel (Pro)
ProIncluded in $99A panel that refreshes like electronic paper, for agent briefs and calm status boards. Partial refreshes redraw only what changed and leave a faint ghost; a full refresh flashes the sheet clean.
On this page
Installation
Needs chatcn Pro
This command works with a Pro license, along with every Pro component.
Or start free: sign up and get three Pro components on us, with a new one every month.
Usage
import { EInkPanel, EInkText } from "@/components/ui/chatcn/pro/e-ink-panel"
<EInkPanel refreshKey={brief.version}>
<Brief brief={brief} />
<EInkText text={answer} />
</EInkPanel>Change refreshKey together with the content. The children stay ordinary DOM: readable, selectable and announced like any other text. The refresh is a layer drawn over them for a quarter of a second, made of still copies of the old and new content, so nothing inside has to know about it.
A partial refresh, the default, finds the region that changed and drives only that, old to new, through three steps of a coarse ordered dither in 90 ms. It leaves a ghost of the old content at 5%, which fades to 2.5% at the next refresh and is gone after that. Every fifth refresh (fullEvery) is full: the old page inverted, a blank sheet, the new page inverted, then two dither steps into the new page, 230 ms in hard steps, and the ghosts are cleared. mode="full" makes every refresh full.
EInkText shows a stream the way an e-reader draws it: whole words, at most once per chunkMs, each chunk struck in with a short ink bar over its line. Use it inside the panel or anywhere else.
The sheet is a warm grey paper with a faint matte grain and one hairline edge. In dark mode it stays paper and only dims, like an unlit e-reader in a dark room. The kit's tokens are re-pointed at paper and ink inside it, so any component you place there renders as print.
Examples
Full refresh, partial with ghost, streaming text, dark theme and reduced motion
Props
| Prop | Type | Notes |
|---|---|---|
refreshKey | unknown | When it changes, the panel refreshes to the new content |
mode | "partial" | "full" | Default partial |
fullEvery | number | In partial mode, every nth refresh is full. Default 5 |
ghost | boolean | Leave a faint ghost after a partial refresh. Default true |
onRefresh | (kind: "full" | "partial") => void | When a refresh starts, with the kind it ran as after the flash limits |
contentClassName | string | Classes for the content box. Default padding 20 px |
reducedMotion | boolean | Force it on or off. Defaults to the user's setting |
EInkText.text | string | The text so far. A text that does not extend it starts over |
EInkText.chunkMs | number | At most one reveal per this many ms. Default 350 |
Accessibility
- The content is live DOM at all times. The refresh layer and the ghosts are
aria-hiddenandinertcopies with their ids removed, so nothing is read twice or focused behind the sheet. - The panel sets
aria-busyfor the quarter second a refresh runs. Put streamed answers in your message live region, as anywhere else in the kit. - Ink and paper keep body text above 7:1 in light and dark; muted text stays above 4.5:1.
- Under
forced-colors: activethe grain, ghosts and refresh layer hide, and the panel keeps its place with a plain outline.
Motion
- Every step is a hard cut, with no easing and no fade, the way e-paper is driven.
- A full refresh flashes twice (the old page and the new page in ink), so the panel runs at most one a second, three flashes at most. A refresh that would break that, or a panel larger than a quarter of the viewport, refreshes partially instead. Changes that arrive during a full refresh join it and it ends on the latest content.
- A streamed word bar is a flash too. Inside a panel, word bars and full refreshes share one budget, so together they never pass three flashes in any second.
- Under reduced motion there are no flashes, dither steps or bars: content changes at once, and the ghosts still show because they do not move.
- Offscreen and in hidden tabs, refreshes land at once.