BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/spectrumui/error-state

Error State

spectrumui/error-state
FreeBlock

A failed-generation state with a preserved prompt and retry.

Install it

npx shadcn@latest add https://ui.spectrumhq.in/r/error-state.json

Source

components/spectrumui/blocks/ai-assistants/error-state.tsxui.spectrumhq.in/r/error-state.json
1'use client';
2
3import { useState } from 'react';
4import { AlertTriangle, Loader2, RefreshCw } from 'lucide-react';
5import { cn } from '@/lib/utils';
6
7export type ErrorStateVariant = 'Card' | 'Inline';
8
9export interface ErrorStateProps {
10 title?: string;
11 message?: string;
12 retryLabel?: string;
13 retrying?: boolean;
14 onRetry?: () => void;
15 variant?: ErrorStateVariant;
16 className?: string;
17}
18
19export function ErrorState({
20 title = 'Generation failed',
21 message = 'The model timed out before finishing. Your prompt is preserved — retrying usually resolves this.',
22 retryLabel = 'Retry',
23 retrying: retryingProp,
24 onRetry,
25 variant = 'Card',
26 className,
27}: ErrorStateProps) {
28 const [retryingState, setRetryingState] = useState(false);
29 const retrying = retryingProp !== undefined ? retryingProp : retryingState;
30
31 function retry() {
32 setRetryingState(true);
33 setTimeout(() => setRetryingState(false), 1600);
34 onRetry?.();
35 }
36
37 if (variant === 'Inline') {
38 return (
39 <div
40 role="alert"
41 className={cn(
42 'flex w-fit items-center gap-2.5 rounded-full border border-red-500/20 bg-red-500/[0.06] py-1.5 pl-3 pr-1.5 text-[12.5px] text-red-700 dark:text-red-400',
43 className,
44 )}
45 >
46 <AlertTriangle className="size-3.5 shrink-0" />
47 <span>{title}</span>
48 <button
49 type="button"
50 onClick={retry}
51 disabled={retrying}
52 className="flex items-center gap-1 rounded-full bg-white px-2 py-0.5 text-[11.5px] font-medium text-neutral-800 shadow-xs transition-transform duration-150 active:scale-[0.95] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-red-400 dark:bg-neutral-900 dark:text-neutral-200"
53 >
54 {retrying ? (
55 <Loader2 className="size-3 animate-spin [animation-duration:800ms]" />
56 ) : (
57 <RefreshCw className="size-3" />
58 )}
59 {retryLabel}
60 </button>
61 </div>
62 );
63 }
64
65 return (
66 <div
67 role="alert"
68 className={cn(
69 'w-full max-w-[420px] rounded-2xl border border-black/[0.08] bg-white p-4 shadow-xs dark:border-white/[0.09] dark:bg-[#0B0B0D]',
70 className,
71 )}
72 >
73 <div className="flex items-start gap-3">
74 <span className="grid size-8 shrink-0 place-items-center rounded-full bg-red-500/10 text-red-600 dark:text-red-400">
75 <AlertTriangle className="size-4" />
76 </span>
77// … truncated

What it pulls in

npm packages

  • lucide-react

Files it writes

  • components/spectrumui/blocks/ai-assistants/error-state.tsx

Facts

Registry
spectrumui
Type
registry:block
Access
Free
Files written
1
Licence
Apache-2.0
First indexed
2026-08-02
Last confirmed
today

Go to the source

ui.spectrumhq.in arihantcodes/spectrum-ui on GitHub Raw registry item This item as JSON

More from spectrumui

All 182 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Agent Planagent-planspectrumuiBlocksFree1 dep
Agent Stepsagent-stepsspectrumuiBlocksFree1 dep · 2 files
Approval Cardapproval-cardspectrumuiBlocksFree1 dep
Chat Empty Statechat-empty-statespectrumuiBlocksFree1 dep · 2 files
Citation Sourcescitation-sourcesspectrumuiBlocksFreeno deps · 2 files
Code Blockcode-blockspectrumuiBlocksFree1 dep
Conversation Listconversation-listspectrumuiBlocksFree1 dep
Diff Viewdiff-viewspectrumuiBlocksFree1 dep
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex