Components
Error State
A prominent failure message with an optional retry action.
Installation
$ npx veil-ui@latest add error-stateUsage
import { ErrorState } from "@/components/ui/error-state";
<ErrorState
title="Could not load invoices"
description="Check your connection and try again."
action={<button type="button">Retry</button>}
/>;Examples
Basic
Something went wrong
An unexpected error occurred. Please try again.
With retry
Could not load invoices
Check your connection and try again.
Custom message
Payment declined
The card issuer rejected the charge.
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
| title | React.ReactNode | "Something went wrong" | Headline for the failure. |
| description | React.ReactNode | Unexpected error copy | Explanation or recovery hint. |
| action | React.ReactNode | — | Recovery control, typically Retry. |
Accessibility
- Rendered inside
role="alert", so it is announced when it appears. - The icon is decorative; keep the title specific so users know what failed.
Vue and plain HTML
This component also ships for Vue (Reka UI) and plain HTML. Install it with npx veil-ui add error-state --framework vue or switch the framework in components.json.
<script setup lang="ts">
import { AlertTriangle } from "lucide-vue-next";
import { cn } from "@/lib/utils";
import type { ErrorStateProps } from "./types";
const props = withDefaults(defineProps<ErrorStateProps>(), {
title: "Something went wrong",
description: "An unexpected error occurred. Please try again.",
});
</script>
<template>
<div
data-slot="error-state"
role="alert"
:class="
cn(
'flex flex-col items-center justify-center gap-3 rounded-lg border border-destructive/30 bg-destructive/5 px-6 py-12 text-center',
props.class,
)
"
>
<div
aria-hidden
class="flex size-10 items-center justify-center rounded-full bg-destructive/10 text-destructive"
>
<AlertTriangle class="size-5" />
</div>
<div class="grid gap-1">
<p class="text-sm font-medium text-foreground">
<slot name="title">{{ title }}</slot>
</p>
<p
v-if="description || $slots.description"
class="text-sm text-muted-foreground"
>
<slot name="description">{{ description }}</slot>
</p>
</div>
<div v-if="$slots.action" class="mt-2">
<slot name="action" />
</div>
</div>
</template>