Loaders
Seven small loaders and a hook that stops quick replies from flashing a spinner.
- Category
- Data & feedback
- Access
- Free with an account
- Source
- 164 lines · one file
- States
- 8 drawn
- Added
- 3 Nov 2026
The decision inside it
Fast answers never flash a spinner
useDelayedLoading waits 300 ms before showing a loader and, once shown, keeps it for at least 500 ms, so a reply at 320 ms doesn't blink. Each loader is a status for screen readers, and with reduced motion they fade instead of spin.
When to use it
Use Loaders inside buttons, rows and panels while something is on its way, with useDelayedLoading so quick replies never flash one. For a whole page use State; for AI generation use Thinking State.
Installation
How you get it
Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.
Use Liro's Loaders for this.
Install it: npx shadcn@latest add @liro/loader
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/loader.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Free components install through the @liro registry with your CLI token: see the Namespaced tab.
Usage
"use client";
import { Loader, useDelayedLoading } from "@/components/ui/loader";
export function SaveButton({ saving, onSave }: { saving: boolean; onSave: () => void }) {
const showLoader = useDelayedLoading(saving);
return (
<button onClick={onSave} disabled={saving} className="inline-flex h-10 items-center gap-2 rounded-lg bg-foreground px-4 text-background">
{showLoader ? <Loader variant="dots" size={18} label="Saving" /> : "Save"}
</button>
);
}API reference
“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.
Props
Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.
| Type | Notes | ||
|---|---|---|---|
variant | LoaderVariant | No | – |
size | number | No | Size in pixels for the shapes; the shimmer follows the text size. Default 20. |
label | string | No | What is happening, for screen readers and, with `shimmer`, on screen. Default "Loading". |
showLabel | boolean | No | Show the label next to the shape. Default false (shimmer always shows it). |
Dependencies
npm packages
clsxtailwind-mergeLiro foundations, installed alongside it
liro-themeStates
All of them are drawn by the component. None is left for you to design.
- Ring
- Orbit
- Dots
- Bars
- Pulse
- Square
- Shimmer
- Delayed
Accessibility
- Keyboard reachable throughout, in visual order
- Focus trapped in overlays, Escape closes them
- Focus returns to whatever opened it
- Live regions announce what changed, not that something did
- Honours prefers-reduced-motion
Responsive behavior
- Sizes to its container, not the viewport
- Usable from 320px up
- Pointer-based interaction, so trackpad and touch both work
- No hover-only affordances