Error State

Error screen or section for offline, not found, server and permission problems, optionally over a faint outline of what failed. It can retry on a countdown and hand smoothly back to your content.

Preview

Installation

npx @lumioui/cli add error-state

Usage

import { ErrorState, errorStateDefaults } from "@/components/ui/error-state/error-state";
<ErrorState />

Also exported: errorStateDefaults.

Examples

Inline with auto-retry

One section of a project dashboard failed with a 503 while the rest loaded.

Not found

A resale marketplace opened from a shared link to a listing that's gone.

Offline

A transit app's Departures tab with no signal.

Permission denied

An expense app's receipt scanner after camera access was denied.

API reference

Prop Type Default
onPress* () => void } —
kind ErrorKind

Which failure — picks the glyph and default copy. Default "generic".

"generic"
layout "screen" | "inline"

"screen" (centred, fills its parent) or "inline" (a failed section). Default "screen".

"screen"
title string

Override the title.

—
description string

Override the help line.

—
code string

Small reference under the help — "Error 503 · Ref 7Q2-K9".

—
icon IconName

Override the glyph.

—
illustration React.ReactNode

Replace the glyph disc with your own illustration.

—
onRetry () => void | Promise<unknown>

Primary action. May return a Promise — rejection counts as a failed retry.

—
retryLabel string

Primary action label. Default per kind ("Try again", "Open Settings"…).

—
retryFailedMessage string

Shown (and announced) after a failed retry.

—
secondaryAction { label: string

Quieter second action.

—
autoRetry number

Retry automatically after this many seconds (restarts after each failure).

—
structure React.ReactNode

The exact layout of the content that failed, drawn dim under the error.

—
onRecover () => void

After a successful retry: the error dims, a sheen crosses the structure, then this fires — show the real content here.

—
className string —