BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/spectrumui/loading-state

Loading State

spectrumui/loading-state
FreeBlock

A pixel-grid loader with a shimmering label and live elapsed timer.

Install it

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

Source

components/spectrumui/blocks/ai-assistants/loading-state.tsxui.spectrumhq.in/r/loading-state.json
1"use client";
2
3import { useEffect, useState } from "react";
4import { cn } from "@/lib/utils";
5
6const KEYFRAMES = `
7@keyframes su-pixel-on { 0%, 100% { opacity: 0.15 } 40% { opacity: 1 } }
8@keyframes su-shimmer-text { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }
9`;
10
11const chevron = Array.from({ length: 9 }, (_, i) => {
12 const r = Math.floor(i / 3),
13 c = i % 3;
14 return (c + Math.abs(r - 1)) * 90;
15});
16
17const ORBIT_ORDER = [0, 1, 2, 5, 8, 7, 6, 3];
18const orbit = Array.from({ length: 9 }, (_, i) => {
19 const k = ORBIT_ORDER.indexOf(i);
20 return k === -1 ? null : k * 110;
21});
22
23export type LoadingStateVariant = "Drive" | "Dots" | "Orbit";
24
25const PATTERNS: Record<
26 LoadingStateVariant,
27 { delays: (number | null)[]; dur: number; round: boolean }
28> = {
29 Drive: { delays: chevron, dur: 650, round: false },
30 Dots: { delays: chevron, dur: 650, round: true },
31 Orbit: { delays: orbit, dur: 950, round: false },
32};
33
34function useElapsed() {
35 const [ds, setDs] = useState(0);
36 useEffect(() => {
37 const t = setInterval(() => setDs((d) => d + 1), 100);
38 return () => clearInterval(t);
39 }, []);
40 const total = ds / 10;
41 if (total < 60) return `${total.toFixed(1)}s`;
42 return `${Math.floor(total / 60)}m ${(total % 60).toFixed(1)}s`;
43}
44
45export interface LoadingStateProps {
46 label?: string;
47 variant?: LoadingStateVariant;
48 className?: string;
49}
50
51export function LoadingState({
52 label = "Churning",
53 variant = "Drive",
54 className,
55}: LoadingStateProps) {
56 const elapsed = useElapsed();
57 const { delays, dur, round } = PATTERNS[variant] ?? PATTERNS.Drive;
58
59 return (
60 <div
61 className={cn(
62 "flex w-fit items-center gap-2.5 text-neutral-900 dark:text-neutral-100",
63 className,
64 )}
65 >
66 <style dangerouslySetInnerHTML={{ __html: KEYFRAMES }} />
67
68 <span aria-hidden className="grid grid-cols-[repeat(3,4px)] gap-[1.5px]">
69 {delays.map((d, i) => (
70 <span
71 key={i}
72 className={cn(
73 "size-[4px] bg-current motion-reduce:!animate-none",
74 round ? "rounded-full" : "rounded-[1px]",
75 )}
76 style={{
77 opacity: d === null ? 0.07 : 0.15,
78 animation:
79 d === null
80 ? "none"
81 : `su-pixel-on ${dur}ms ease-in-out ${d}ms infinite`,
82 }}
83 />
84 ))}
85 </span>
86
87 <span
88// … truncated

Files it writes

  • components/spectrumui/blocks/ai-assistants/loading-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