Error empty

Error-family empty states for the ai2 styled layer: five static, centered components (ErrorEmpty, OfflineEmpty, DeniedEmpty, TimeoutEmpty, BrokenEmpty) that each show a semantic tone badge, a title, a description, and an optional action. Sizes run from sm to xl.

componentstyledemptyregistry-item.json
Error empty
LIVE · running in a sandboxed iframe
Installed with shadcn add · 2 workarounds · theme from registry.json
  • applied the registry's theme (tokens, fonts and CSS from the registry preview settings)
  • installed base item https://ai2.design/r/tokens.json (registry preview settings)
See how it was built

Installation

pnpm dlx shadcn@latest add @ai2/empty-error

Requires @ai2 in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import { ErrorEmpty } from "@/components/ui/empty-error"export function Example() {  return <ErrorEmpty />}
  • Show a recoverable server or loading failure inside a panel, card, or list where a retry button helps (ErrorEmpty or TimeoutEmpty).
  • Indicate lost connectivity or pending sync with OfflineEmpty.
  • Explain a permission or access restriction and offer a request-access action with DeniedEmpty.
  • Display a broken, moved, or missing resource with no action using BrokenEmpty.

Examples

Default server error with retry

Renders ErrorEmpty with its built-in copy and the Try again button.

default-server-error-with-retry.tsx
import { ErrorEmpty } from "@/components/ui/empty-error"export function ReportsError() {  return <ErrorEmpty size='lg' />}

Offline state with custom action

Replaces the default Reconnect button by passing the action prop, at small size inside a sidebar.

offline-state-with-custom-action.tsx
import { Button } from "@/components/ui/button"import { OfflineEmpty } from "@/components/ui/empty-error"export function SyncPanel() {  return (    <OfflineEmpty      size='sm'      action={<Button variant='outline' size='sm'>Retry sync</Button>}    />  )}

Broken link with custom copy and icon

BrokenEmpty has no default action, so none appears unless one is supplied. Here a custom title, description, and icon are passed.

broken-link-with-custom-copy-and-icon.tsx
import { Home } from "lucide-react"import { BrokenEmpty } from "@/components/ui/empty-error"export function NotFoundSection() {  return (    <BrokenEmpty      size='xl'      icon={<Home />}      title='Page not found'      description='This address no longer points anywhere. Head back to the dashboard.'    />  )}

API reference

PropTypeDefaultDescription
classNamestring—Additional classes merged onto the root div via cn(). Applies to all five components.
size"sm" | "md" | "lg" | "xl""md"Scale preset controlling root padding and gap, badge size, icon size, and title and description text size. The StyledSize type is exported from the module.
iconReact.ReactNode—Replaces the default icon inside the badge. When omitted, each variant uses its own lucide icon (ServerCrash, CloudOff, Lock, TimerReset, or Unplug).
titleReact.ReactNodeVaries per component: ErrorEmpty "Something went wrong", OfflineEmpty "You are offline", DeniedEmpty "You do not have access", TimeoutEmpty "This is taking too long", BrokenEmpty "This link is broken"Heading text rendered in a paragraph element with semibold weight.
descriptionReact.ReactNodeVaries per component; each has its own default sentenceSupporting text below the title. When falsy (for example an empty string or null), the paragraph is not rendered.
actionReact.ReactNodeErrorEmpty, OfflineEmpty, DeniedEmpty, TimeoutEmpty: a built-in outlined button (Try again, Reconnect, Request access, Reload). BrokenEmpty: nullReplaces the component's default action. Wrapped in a div with mt-2. For BrokenEmpty, passing this prop is the only way to show an action.

Accessibility

  • The icon badge wrapper has aria-hidden="true", so decorative icons are not announced by screen readers. Give the title and description meaningful text, since they carry the message.
  • The default action is a native button with type="button", so it is keyboard focusable and activates with Enter or Space. It has no onClick handler; wire behavior via a wrapper or by supplying a custom action element.
  • Title is a p element, not a heading. If the empty state is the main message of a section, wrap it in an element with an appropriate heading structure or pass a heading element through the title prop.
  • Focus-visible shows a 3px ring-ring/50 outline on the default button. Color transitions are removed under prefers-reduced-motion.
  • Tone is conveyed by color and by the title and description text. Do not rely on the badge tint alone; the copy should state the problem.

Docs written by anthropic:claude-haiku-5-5 from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "Error empty" component (ai2/empty-error) from its shadcn registry.1. Install it with: npx shadcn@latest add @ai2/empty-error2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: className, size, icon, title, description, action.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { ErrorEmpty } from "@/components/ui/empty-error"export function Example() {  return <ErrorEmpty />}```

Files & dependencies

  • registry/ai2/styled/empty-error.tsx→ components/ui/empty-error.tsx
dependencieslucide-react@^1.23.0
registryDependencies@ai2/tokens

Looks similar, elsewhere