BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/motiq/data-refresh-state

Data Refresh State

motiq/data-refresh-state
FreeComponent

A rich, accessible refresh indicator your app drives: idle, checking, refreshing (determinate or honestly-indeterminate), partially updated, success, stale, offline, error, paused, and cancelled — with manual refresh, cancel, retry, pause/resume, and interval controls in compact, inline, and panel modes. Never spins on idle, never fakes progress, and never signals status by color alone. Presentation-only: the host owns the fetch and progress.

Live preview

live · rendered by the registry
Rendered by motiq on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://www.motiq.dev/r/data-refresh-state.json

Source

registry/data/data-refresh-state.tsxwww.motiq.dev/r/data-refresh-state.json · first 6 KB
1"use client";
2
3import * as React from "react";
4import { motion, AnimatePresence } from "motion/react";
5
6import { cn } from "@/lib/utils";
7import {
8 useReducedMotion,
9 useAnimatedNumber,
10 useDisclosure,
11 useAnchoredPortal,
12 getStatusMeta,
13 statusVars,
14 formatTimestamp as sharedFormatTimestamp,
15 type StatusMeta,
16 type StatusTone,
17} from "@/lib/motiq";
18
19/* -------------------------------------------------------------------------- */
20/* Custom interval dropdown — a real library listbox popover (not a native
21 <select>): keyboard-navigable, dismiss-on-outside-click, animated, themed. */
22/* -------------------------------------------------------------------------- */
23
24const formatInterval = (ms: number) => (ms >= 60000 ? `${Math.round(ms / 60000)}m` : `${Math.round(ms / 1000)}s`);
25
26function IntervalSelect({
27 value,
28 options,
29 onChange,
30}: {
31 value: number;
32 options: number[];
33 onChange: (ms: number) => void;
34}) {
35 const reduce = useReducedMotion();
36 const menu = useDisclosure({ idPrefix: "mk-interval", dismissable: true });
37 const anchor = useAnchoredPortal(menu.open, { align: "end" });
38 const current = options.includes(value) ? value : options[0];
39 const [activeIdx, setActiveIdx] = React.useState(() => Math.max(0, options.indexOf(current)));
40
41 React.useEffect(() => {
42 if (menu.open) setActiveIdx(Math.max(0, options.indexOf(current)));
43 }, [menu.open, current, options]);
44
45 const commit = (ms: number) => {
46 onChange(ms);
47 menu.setOpen(false);
48 };
49
50 const onKeyDown = (e: React.KeyboardEvent) => {
51 if (!menu.open) {
52 if (e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") {
53 e.preventDefault();
54 menu.setOpen(true);
55 }
56 return;
57 }
58 if (e.key === "ArrowDown") { e.preventDefault(); setActiveIdx((a) => Math.min(options.length - 1, a + 1)); }
59 else if (e.key === "ArrowUp") { e.preventDefault(); setActiveIdx((a) => Math.max(0, a - 1)); }
60 else if (e.key === "Home") { e.preventDefault(); setActiveIdx(0); }
61 else if (e.key === "End") { e.preventDefault(); setActiveIdx(options.length - 1); }
62 else if (e.key === "Enter" || e.key === " ") { e.preventDefault(); commit(options[activeIdx]); }
63 };
64
65 return (
66 <div ref={menu.rootRef as React.RefObject<HTMLDivElement>} className="relative" onKeyDown={onKeyDown}>
67 <button
68 type="button"
69 {...menu.triggerProps}
70 ref={anchor.triggerRef as React.RefObject<HTMLButtonElement>}
71 aria-haspopup="listbox"
72// … truncated

What it pulls in

npm packages

  • motion

Other registry items

  • https://motiq.dev/r/utils.json
  • https://motiq.dev/r/primitives.json

Files it writes

  • registry/data/data-refresh-state.tsx

Facts

Registry
motiq
Type
registry:component
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-12
Last confirmed
today

Go to the source

Docs on motiq www.motiq.dev RMahammad/motiq on GitHub Raw registry item This item as JSON

More from motiq

All 100 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Activity Streamactivity-streammotiqComponentsFree1 dep
Adaptive Safe-Zone Gridadaptive-safe-zone-gridmotiqComponentsFreeno deps
Agent Run Timelineagent-run-timelinemotiqComponentsFree1 dep
AI Response Streamai-response-streammotiqComponentsFree1 dep
Animated Accordionanimated-accordionmotiqComponentsFree2 deps
Animated Buttonanimated-buttonmotiqComponentsFree1 dep
Animated Dialoganimated-dialogmotiqComponentsFree2 deps
Animated Gridanimated-gridmotiqComponentsFree2 deps
BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

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

© 2026 BlockDex. A Kynth Studios product.

BlockDex

BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

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

© 2026 BlockDex. A Kynth Studios product.

BlockDex

BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

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

© 2026 BlockDex. A Kynth Studios product.

BlockDex