A small inline loader for an agent run. One glyph for each phase (thinking, searching, reading, writing, running a tool, waiting for you, done, failed), a short label and an optional timer, small enough for a chat bubble, a button, a table row or a toast.
On this page
- Chat bubble
- Button while it runs
- Table row status
- Toast
- Status bar
Examples
Every phase
Finishing a run
In a chat bubble
On a button
In a table row
In a toast
Installation
npx knowns-ui@latest add agent-loaderPaste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install Agent loader from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/agent-loader
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add agent-loader
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/illustrations/illust-utils.ts
- components/ui/knowns/illustrations/use-in-view.ts
- components/ui/knowns/text-animation/text-core.tsx
- components/ui/knowns/text-animation/shimmer-text.tsx
- components/ui/knowns/agent-loader/agent-loader.tsx
- components/ui/knowns/agent-loader/agent-loader-utils.ts
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/agent-loader, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "agent-loader" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.Props
- phase
"think"|"search"|"read"|"write"|"tool"|"wait"|"done"|"error"- The step the run is in. Picks the glyph, its loop and its colour.
- label
string- Default
a word for the phase - Text next to the glyph, e.g. "Searching the docs". Changing it settles the new text in.
- showLabel
boolean- Default
true - false leaves just the glyph. A screen reader still hears the label.
- startedAt
number|Date- When the run started. Shows the elapsed time and ticks it while the agent is busy.
- endedAt
number|Date- When it ended. The time stops there; without it the time holds at the moment the run finished.
- elapsed
number- Seconds, if you track them yourself. Wins over startedAt.
- size
"sm"|"md"|"xl"- Default
"sm" - 16px, 20px, or a 112px mark for a hero or a status panel.
- layout
"inline"|"stack"- Default
"inline" ("stack" for xl) - Label beside the glyph, or centred under it, the time beside the label.
- morph
boolean- Default
true for xl - On a phase change, the old glyph twists out and the new one twists in (280ms, ease in-out) instead of the 120ms crossfade.
- tone
"accent"|"neutral"- Default
"accent" - Tint of a working glyph. Waiting (amber), done (green) and failed (red) always keep their status colour.
- shimmer
boolean- Default
true - Sweep a light band through the label while the agent is busy.
- AgentLoaderMark
{ phase, size?, tone?, morph? }- Just the glyph, for a button icon or a row. Decorative: pair it with text.
| Prop | Type | Default | Description |
|---|---|---|---|
| phase | "think" | "search" | "read" | "write" | "tool" | "wait" | "done" | "error" | - | The step the run is in. Picks the glyph, its loop and its colour. |
| label | string | a word for the phase | Text next to the glyph, e.g. "Searching the docs". Changing it settles the new text in. |
| showLabel | boolean | true | false leaves just the glyph. A screen reader still hears the label. |
| startedAt | number | Date | - | When the run started. Shows the elapsed time and ticks it while the agent is busy. |
| endedAt | number | Date | - | When it ended. The time stops there; without it the time holds at the moment the run finished. |
| elapsed | number | - | Seconds, if you track them yourself. Wins over startedAt. |
| size | "sm" | "md" | "xl" | "sm" | 16px, 20px, or a 112px mark for a hero or a status panel. |
| layout | "inline" | "stack" | "inline" ("stack" for xl) | Label beside the glyph, or centred under it, the time beside the label. |
| morph | boolean | true for xl | On a phase change, the old glyph twists out and the new one twists in (280ms, ease in-out) instead of the 120ms crossfade. |
| tone | "accent" | "neutral" | "accent" | Tint of a working glyph. Waiting (amber), done (green) and failed (red) always keep their status colour. |
| shimmer | boolean | true | Sweep a light band through the label while the agent is busy. |
| AgentLoaderMark | { phase, size?, tone?, morph? } | - | Just the glyph, for a button icon or a row. Decorative: pair it with text. |
What it handles
- 01Gives each phase of an agent run its own small glyph and loop: dots that breathe, a lens that sweeps, lines that scan, a caret that writes, brackets that pulse, a ring that asks for you.
- 02Crossfades the glyph when the phase changes and swaps the label with a short settle.
- 03Plays done and failed once: a check that draws, or a shake and an X. A run that arrives already finished paints still.
- 04Shows an optional elapsed time that ticks once a second while the agent is busy and stops when the run ends.
- 05Tells a screen reader the label once per phase change, not on every tick.
- 06Fits a button, a bubble, a table cell or a toast at 16 or 20px, in light and dark.
States
- First render
- Only the loop of an active phase. Done and failed paint still
- none
- Active phase
- The glyph loops: breathe, sweep, scan, write, pulse; the label shimmers
- 1.3 to 2.2s per loop, ease in-out
- Phase change
- The old glyph fades out as the new one fades in; the label settles
- 120ms out, 180ms in, ease out
- Waiting for you
- A slow ring pulses, amber; the label does not shimmer
- 2.2s, ease out
- Done
- The ring pops and the check draws once
- 280ms, ease out
- Failed
- The glyph shakes once and the X draws
- 280ms, ease out
- Phase change, xl or morph
- The old glyph twists out (60 degrees) as the new one twists in; the mark reads as one thing changing shape
- 280ms, ease in-out
- Reduced motion
- A still glyph for each phase, no loop, no shimmer
- 0ms
| State | What moves | Timing |
|---|---|---|
| First render | Only the loop of an active phase. Done and failed paint still | none |
| Active phase | The glyph loops: breathe, sweep, scan, write, pulse; the label shimmers | 1.3 to 2.2s per loop, ease in-out |
| Phase change | The old glyph fades out as the new one fades in; the label settles | 120ms out, 180ms in, ease out |
| Waiting for you | A slow ring pulses, amber; the label does not shimmer | 2.2s, ease out |
| Done | The ring pops and the check draws once | 280ms, ease out |
| Failed | The glyph shakes once and the X draws | 280ms, ease out |
| Phase change, xl or morph | The old glyph twists out (60 degrees) as the new one twists in; the mark reads as one thing changing shape | 280ms, ease in-out |
| Reduced motion | A still glyph for each phase, no loop, no shimmer | 0ms |
Works with
When to use
When to use
- A one-line loader for an agent run in a chat bubble, a button, a table row, a toast or a footer.
- Telling someone the agent is waiting on them, not working.
When not to use
- Showing the steps behind the work: use Thinking State.
- A plain spinner with no phase: use Spinner.
- Progress with a known end: use Progress.
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI Agent Loader to my app and wire it to my own data.
- I need a one-line loader for an agent run in a chat bubble, a button, a table row, a toast or a footer. Set that up with the Knowns UI Agent Loader.
- Which Agent Loader props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "agent-loader" }) and search_docs({ query: "agent loader" }).