Error State

Error State says something failed, which is a different thing from nothing being here, and offers a retry.

Installation

Nothing to add. This component ships as source in your download, so it is already in your project.

Filesrc/vui/error-state.tsx
Import from@viliha/vui-react/error-state

The exported names are at the top of that file. The import path is an alias the download's tsconfig.json points at src/vui/, so you can move that folder and change one line rather than every file that imports from it.

Usage

error-state-demo.tsx
import { ErrorState } from "@viliha/vui-react/error-state";

Exports

Everything this family exports. They are read from the source, so this list is what the package actually ships.

PropTypeDefault
ErrorStatecomponent—

ErrorState props

Plus everything Omit<React.ComponentProps<"div">, "title"> accepts, passed straight through to the underlying element.

PropTypeDefault
title?React.ReactNodeERROR_STATE_COPY.title
description?React.ReactNodeERROR_STATE_COPY.description
icon?React.ReactNode—
retryLabel?stringERROR_STATE_COPY.retryLabel
onRetry?() => void—
headingLevel?2 | 3 | 42

Customize

Every value this component draws comes from the theme: the colours, the radius, the control height and the type scale. Change a token and this moves with everything else, which is the difference between theming the product and overriding a component. See Theming for the token contract, and Swapping defaults for replacing the markup itself.