Error report log (small)
@interlace/ui — the small half of error reporting: a typed report, a flood counted not repeated, the ring of recent reports and the browser handlers. All a first page load needs; no DOM, no network.
Install
Two equivalent paths — the URL works in any shadcn-CLI setup; the alias works once you've registered @interlace in your components.json.
npx shadcn@latest add https://ds.interlace.tools/r/error-report-log-model.jsonnpx shadcn@latest add @interlace/error-report-log-modelHistory
This component is at v1.0.0, first shipped in @interlace/ui 2.4.0. The version is stamped as a banner into the file the install writes, so the copy in your tree says which one you have — compare it with the number above before deciding whether to re-run the install.
@interlace/ui 2.4.11 entry
- Changedpatch
The small error log is now tested on its own, with and without a listener, so a change to how it tells listeners is caught.
@interlace/ui 2.4.01 entry
- Addedminor
reportErrorno longer costs a page the whole error log. The small half (the report, the ring of recent reports, the flood rule,installGlobalHandlers) is its own entry,@interlace/ui/error-report-core, 992 B gzipped against 1,412 B before; listeners, restore,installErrorLog,formatReportsand the fallback copy stay in@interlace/ui/error-report-model, imported only where used.@interlace/ui/error-reportstill exports every name it did.createErrorLogis unchanged;extendErrorLogandcreateCoreLogare new. A test bundles the first-load path and fails above 1,000 B gzipped. No new dependency for consumers, no network call.
Import
17 named exports — pull the parts you need.
import { DEFAULT_COALESCE_MS, DEFAULT_LIMITS, DEFAULT_MAX, DEFAULT_MAX_MESSAGE, DEFAULT_MAX_STACK_LINES, ELLIPSIS, GlobalEventTarget, Reporter, UNPRINTABLE, attachGlobalHandlers, buildReport, createCoreLog, defaultMakeId, developmentReporter, isDevelopment, trimMessage, trimStack } from '@/lib/error-report-log-model';Accessibility
Every story for this component is rendered headlessly and checked with axe-core (wcag2aa, wcag22aa, best-practice, ACT) on every PR. That gate has no continue-on-error, so what ships has zero known violations.
What follows is what static analysis can see. Axe cannot press a key and never sees an overlay open, so the operable-without-a-mouse claim lives in Behavior instead, where the keyboard path is replayed step by step.
- Focus + keyboard behaviour
- Native element semantics — no interaction layer to get wrong.
- Focus ring (WCAG 2.2 SC 2.4.13)
- Not focusable — no focus indicator required.
- Reduced motion
- No animation to gate.
- ARIA in the source
- None — semantics come from the element or the Base UI primitive rather than hand-written ARIA.
Dependencies
- Base UI primitive
- Native / no Base UI dependency
- Lucide icons
- none
- NPM dependencies
- none
- Registry dependencies
- none
Source
The full implementation — lib/error-report-log-model.ts once installed.
export interface ErrorReport {
/** A stable id for this report, from `makeId`; never derived from the message. */
id: string;
/** Epoch ms from the injected clock. */
at: number;
/** What the person was doing, chosen by the caller: 'checkout: save', 'uncaught', 'route: /play'. */
where: string;
/** Redacted, then trimmed to `maxMessage` characters. */
message: string;
/** Redacted, then trimmed to `maxStackLines` lines. Absent when the thrown value had no stack. */
stack?: string;
fatal: boolean;
/** 1 for a single report; more when the same `where` and `message` repeated within `coalesceMs`. */
count: number;
}
export type Reporter = (report: ErrorReport) => void;
export interface ErrorLogOptions {
/** How many reports the log keeps. @default 25 */
…269 more lines…Registry JSON
The raw registry record — what the shadcn CLI fetches.