Empty State

View as Markdown

What a view shows when it's empty, after a failure, or when access is refused, for a whole page or inside a table or list.

No runs yet

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

When to use

What a view shows when it's empty, after a failure, or when access is refused, for a whole page or inside a table or list. Use Skeleton instead when the content is on its way, not missing.

Usage

import { EmptyState } from "./ui/uicontext/components/States.ts"
export const IssuesBody = <M>(h: Html.H<M>, issues: ReadonlyArray<string>) =>	issues.length === 0		? EmptyState(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

EmptyStateView function

Options

EmptyState options
NameTypeDefaultDescription
titlerequiredstring—What isn't here, plainly: "No connectors yet"
hintstring—Why, or what will appear here: "Connected apps show here. Agents use only the ones you connect."
iconstring—One character or symbol, decorative
actionsView.Children—The 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
variant"page" | "compact"pagepage for a whole page or section; compact inside a table, a list or a panel; page by default
styleStyle—StyleX styles applied after the empty state's own.

Keyboard and accessibility

  • 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.

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/empty-state

Source