Empty State

What a view shows while loading, when empty, after a failure, or when access is refused.

No runs yet

Runs show here once Invoice sync is triggered. Run it now to see one.

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/states

Usage

import { Empty, Skeleton } from "./ui/uicontext/components/kit/States.ts"
export const IssuesBody = <M>(h: Html.H<M>, issues: ReadonlyArray<string> | null) =>	issues === null		? Skeleton(h, { label: "Loading issues", shape: "rows", count: 5 })		: issues.length === 0			? Empty(h, { title: "No open issues", hint: "Issues you're assigned show here." })			: h.ul.children(issues.map((title) => h.li.key(title).children(title)))

API reference

ErrorBannerComponent

Props

ErrorBanner props
NameTypeDescription
agentIdstringThis banner's id for agents, unique on the page: "spend-limit-error"
rejectionrequiredstring | nullThe rejection's _tag, or null for no banner
copyrequiredRecord<string, RejectionCopy>The app's table: one entry per rejection tag
fallbackRejectionCopyFor a tag the table lacks; a generic "That didn't work" by default
dismissiblebooleanShows a dismiss button that emits RequestedDismiss
urgentbooleanAnnounce at once (a failed action) or politely (a state the page is in)

Events

ErrorBanner events
EventPayloadDescription
RequestedAction{ rejection: string }The person asked for the next step of this rejection
RequestedDismiss{ rejection: string }The person dismissed the banner; stop passing this rejection

Agent actions

What agents can do with ErrorBanner
ActionDescription
ClickedActionTake the banner's next step (its action)
ClickedDismissDismiss the banner

SkeletonView function

Options

Skeleton options
NameTypeDefaultDescription
labelrequiredstring—What is loading, for screen readers: "Loading members"
shape"text" | "rows" | "block"—Text lines, list rows with a leading mark, or one block (a card, a chart)
countnumber3How many lines or rows; 3 by default
styleStyle—StyleX styles applied after the placeholder's own.

EmptyView function

Options

Empty options
NameTypeDescription
titlerequiredstringWhat isn't here, plainly: "No connectors yet"
hintstringWhy, or what will appear here: "Connected apps show here. Agents use only the ones you connect."
iconstringOne character or symbol, decorative
actionsView.ChildrenThe one thing to do about it: usually a single Button
heading"h2" | "h3" | "p"A heading level for the title when the empty state stands for a whole page
styleStyleStyleX styles applied after the empty state's own.

Accessibility

  • A skeleton is one status marked aria-busy and named by its label; its bars are hidden from screen readers.
  • An empty state's title can be an h2 or h3 when it stands for a whole page.
  • An error banner is an alert, or a polite status with urgent: false; its next step is a real button or link and its dismiss button is labelled.
  • Agents read the banner's sentence, next step and action, and can take the next step or dismiss it, as a person would.

Source