ErrorState
Generic error state, composed on Empty. Replaces the five per-feature
"something went wrong" implementations with one primitive: an icon, a
title, an optional message, and an optional retry action.
Usage
import { ErrorState, ErrorStateProps, ErrorStateTone } from "@desk/ui/components/error-state";Best practices
ErrorStaterenders a failure UI (icon / title / message / retry) but does not catch errors — wrap the throwing subtree in anErrorBoundaryand render this in itsfallback.Pass
retryto show the retry button (omit it to hide); it's built onEmpty, solayout/minHeightprops pass straight through.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| actions | React.ReactNode | Additional actions rendered alongside the retry button. | |
| icon | LucideIcon | Icon shown above the title. Defaults based on | |
| message | React.ReactNode | Supporting copy describing what went wrong. | |
| retry | () => void | Called when the retry button is pressed. Omit to render no retry button. | |
| retryLabel | string | Retry button label. Defaults to "Try again". | |
| retryTestId | string | Test id applied to the retry button, for Playwright targeting. | |
| tone | ErrorStateTone | Semantic tone driving the icon color. Defaults to "danger". | |
| title | React.ReactNode | Heading text. Defaults to "Something went wrong". | |
| layout | EmptyLayout | "centered" | Layout variant. |
| minHeight | string | "min-h-[50vh]" | Tailwind min-height class applied only in the |
| size | "base" | "sm" | "lg" | null | undefined |
Also exports
- interface
ErrorStateProps - type
ErrorStateTone