Skip to content
GitHub (opens in a new tab)

LoadError

What a list, card, chart or page shows when its data failed to load: an icon, what failed, a reference and Try again.

stableMoleculecontracts/loaderror.json

Preview

LoadError

What a list, card, chart or page shows when its data failed to load. Same sizes as Empty.

Master

sm, with a reference and Try again.

Usage

role=alert, a CircleX icon and words, so colour is never the only signal. Name what failed, give a reference people can copy, and pass onRetry for the Try again Button (KitLabels tryAgain). Put it in the space the Skeleton held; focus stays put. After a retry that fails again, focus returns to Try again.

Do's

  • A request for a region's data failed
  • A Skeleton is replaced by the failure in the same space
  • A support reference should be copyable

Don'ts

  • Nothing to show but nothing failed — use Empty
  • A page-level notice or a failed save — use Alert or Toast
  • A form field is invalid — use Field error
<LoadError
  message="Couldn’t load invoices."
  reference="Ref 7F3A-91C2"
  onRetry={reload}
/>

When to use

  • A request for a region's data failed
  • A Skeleton is replaced by the failure in the same space
  • A support reference should be copyable

When not to use

  • Nothing to show but nothing failed — use Empty
  • A page-level notice or a failed save — use Alert or Toast
  • A form field is invalid — use Field error

What an agent reads

import { LoadError } from "agentic-ds-kit";
must
  • role=alert, so the failure is read when it appears
  • The CircleX icon is aria-hidden; the message says what failed, so colour is never the only signal
  • Focus stays put when the error replaces a Skeleton; it returns to Try again only after the person pressed it
  • Try again is a kit Button with one verb
defaults
  • size sm
stops if
  • Do not build a local error row or banner for failed data — use LoadError
  • Do not label the button Retry or Reload — the label is Try again (KitLabels tryAgain)
  • Do not show the failure with colour alone
  • Do not leave the Skeleton on screen after a failure
  • Do not use raw hex or primitive --color-* ramps

From contracts/loaderror.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
messagestringYes—What failed, named, like "Couldn't load invoices." Not "Something went wrong".
referencestringNo—Text people can copy for support, rendered as given in mono under the message, like "Ref 7F3A-91C2".
onRetryfunctionNo—Shows a neutral sm "Try again" Button (KitLabels tryAgain). If a retry fails again and focus was lost with the old button, the new LoadError focuses Try again; otherwise focus stays put.
sizesm | md | lgNosmSame scale as Empty. sm: in a chart, list or table cell, bare 16px icon and the message on one row. md: a card body, 32px danger tile. lg: a page, 40px tile and a heading-5 message, like Empty lg.
  • Component
    →

    Empty

    Placeholder when a list, page, or region has nothing to show.

  • Component
    →

    Alert

    Inline status banner that stays on the page.

  • Component
    →

    Toast

    A short note that floats in after an action, like Saved successfully, and goes away on its own after a few seconds, with an optional Undo.

  • Component
    →

    Field

    One labeled control with optional hint and an error or success message.