Thinking Orbs
A swarm of dots that takes a different shape for each thing an agent is doing.
import { ThinkingOrbs, type ThinkingOrbsState } from '@/components/panelui/thinking-orbs';
const STATES: { state: ThinkingOrbsState; name: string }[] = [
{ state: 'thinking', name: 'Thinking' },
{ state: 'searching', name: 'Searching' },
{ state: 'reading', name: 'Reading' },
{ state: 'writing', name: 'Writing' },
{ state: 'solving', name: 'Solving' },
{ state: 'listening', name: 'Listening' },
{ state: 'waiting', name: 'Waiting' },
{ state: 'done', name: 'Done' },
{ state: 'error', name: 'Error' },
{ state: 'idle', name: 'Idle' },
];
export default function ThinkingOrbsOverview() {
return (
<div className="grid grid-cols-2 gap-x-10 gap-y-10 sm:grid-cols-5">
{STATES.map(({ state, name }) => (
<div key={state} className="flex flex-col items-center gap-3">
<ThinkingOrbs state={state} size={84} />
<span className="text-xs text-muted-foreground">{name}</span>
</div>
))}
</div>
);
}Use it beside an assistant's answer, in a composer or on a voice screen, to say what the assistant is doing while there is nothing to read yet. Each state is a shape: a globe with a beam going round it for a search, lines on a drum for reading, two strands for writing, a cube turning its slices for working something out.
The dots are the same ones in every state. Change state and they pour from one shape into the next.
It says what kind of work is being done and not how far along it is. Where the share done is known, show that too. For a button or a field that is busy, Spinner is smaller and plainer.
Installation
npx shadcn@latest add https://panelui.dev/r/web/thinking-orbs.jsonpnpm dlx shadcn@latest add https://panelui.dev/r/web/thinking-orbs.jsonyarn dlx shadcn@latest add https://panelui.dev/r/web/thinking-orbs.jsonbunx shadcn@latest add https://panelui.dev/r/web/thinking-orbs.jsonThe source is copied into components/panelui/, where you can edit it.
Usage
import { ThinkingOrbs } from "@/components/panelui/thinking-orbs"<ThinkingOrbs state="searching" />
<ThinkingOrbs state="reading" size={24}>
<ThinkingOrbs.Label>Reading 6 release notes</ThinkingOrbs.Label>
</ThinkingOrbs>Composition
<ThinkingOrbs>
<ThinkingOrbs.Label />
</ThinkingOrbs>
<ThinkingOrbs.Relay />ThinkingOrbs.Label— What is being done, in words, beside the orb. New words roll in as the old ones roll out, and a highlight sweeps along them while there is work going on. Without text it is the state's own name.ThinkingOrbs.Relay— Several agents' orbs in a row, one of them at work. Whenvaluechanges, dots leave the first orb, cross in an arc and join the next.
Examples
Changing state
Change state and the swarm moves to its new shape, starting from wherever its dots are. ThinkingOrbs.Label rolls to its new words at the same time.
'use client';
import { useEffect, useState } from 'react';
import { ThinkingOrbs, type ThinkingOrbsState } from '@/components/panelui/thinking-orbs';
const RUN: { state: ThinkingOrbsState; says: string }[] = [
{ state: 'listening', says: 'Listening' },
{ state: 'thinking', says: 'Thinking about the question' },
{ state: 'searching', says: 'Searching the changelog' },
{ state: 'reading', says: 'Reading 6 release notes' },
{ state: 'solving', says: 'Finding what broke the build' },
{ state: 'writing', says: 'Writing the fix' },
{ state: 'waiting', says: 'Waiting for your approval' },
{ state: 'done', says: 'Merged to main' },
];
export default function ThinkingOrbsMorph() {
const [at, setAt] = useState(0);
useEffect(() => {
const timer = window.setTimeout(() => setAt((at + 1) % RUN.length), 2600);
return () => window.clearTimeout(timer);
}, [at]);
const step = RUN[at]!;
return (
<ThinkingOrbs state={step.state} size={148} className="flex-col gap-5">
<ThinkingOrbs.Label className="w-72 text-center">{step.says}</ThinkingOrbs.Label>
</ThinkingOrbs>
);
}Finishes
finish is how the shape is drawn. dots draws each point. links joins the points that are near each other. halftone prints the shape through a fixed screen, so the screen's own dots swell and shrink as the shape moves behind them.
'use client';
import { useEffect, useState } from 'react';
import { ThinkingOrbs, type ThinkingOrbsFinish, type ThinkingOrbsState } from '@/components/panelui/thinking-orbs';
const FINISHES: ThinkingOrbsFinish[] = ['dots', 'links', 'halftone'];
const STATES: ThinkingOrbsState[] = ['thinking', 'searching', 'solving', 'writing'];
export default function ThinkingOrbsFinishes() {
const [at, setAt] = useState(0);
useEffect(() => {
const timer = window.setInterval(() => setAt((value) => (value + 1) % STATES.length), 3200);
return () => window.clearInterval(timer);
}, []);
return (
<div className="flex flex-wrap items-center justify-center gap-12">
{FINISHES.map((finish) => (
<div key={finish} className="flex flex-col items-center gap-4">
<ThinkingOrbs state={STATES[at]} finish={finish} size={132} />
<span className="text-xs capitalize text-muted-foreground">{finish}</span>
</div>
))}
</div>
);
}Trails
finish="trails" draws the way each point has come, fading behind it, so the shape is made of strokes. The faster a state moves, the longer they are. It uses fewer points than dots, since a trail fills more room.
import { ThinkingOrbs, type ThinkingOrbsState } from '@/components/panelui/thinking-orbs';
const STATES: ThinkingOrbsState[] = ['thinking', 'searching', 'writing', 'listening'];
export default function ThinkingOrbsTrails() {
return (
<div className="grid grid-cols-2 gap-x-12 gap-y-8 sm:grid-cols-4">
{STATES.map((state) => (
<div key={state} className="flex flex-col items-center gap-3">
<ThinkingOrbs state={state} finish="trails" size={120} />
<span className="text-xs capitalize text-muted-foreground">{state}</span>
</div>
))}
</div>
);
}Glyphs
finish="glyphs" types the shape out, a character to a cell, with a heavier one where there is more of it. It suits a terminal or a code tool. Below about 40 pixels the characters are too small to tell apart; use dots.
import { ThinkingOrbs, type ThinkingOrbsState } from '@/components/panelui/thinking-orbs';
const STATES: ThinkingOrbsState[] = ['thinking', 'searching', 'solving', 'done'];
export default function ThinkingOrbsGlyphs() {
return (
<div className="grid grid-cols-2 gap-x-12 gap-y-8 sm:grid-cols-4">
{STATES.map((state) => (
<div key={state} className="flex flex-col items-center gap-3">
<ThinkingOrbs state={state} finish="glyphs" size={120} />
<span className="text-xs capitalize text-muted-foreground">{state}</span>
</div>
))}
</div>
);
}Sizes
size is in pixels, from 16 up. A small orb is made of fewer dots and a large one of more, so the shape holds at every size. count sets the number yourself.
import { ThinkingOrbs } from '@/components/panelui/thinking-orbs';
export default function ThinkingOrbsSizes() {
return (
<div className="flex flex-wrap items-center justify-center gap-8">
{[16, 20, 24, 32, 48, 72, 112].map((size) => (
<ThinkingOrbs key={size} state="searching" size={size} />
))}
</div>
);
}Colours
It draws in the text colour. With tone="auto", the default, done, error and waiting take the success, destructive and warning roles. Any other tone is one colour throughout.
import { ThinkingOrbs } from '@/components/panelui/thinking-orbs';
export default function ThinkingOrbsTones() {
return (
<div className="flex flex-wrap items-center justify-center gap-10">
<ThinkingOrbs state="thinking" size={72} tone="current" className="text-muted-foreground" />
<ThinkingOrbs state="thinking" size={72} tone="info" />
<ThinkingOrbs state="thinking" size={72} tone="success" />
<ThinkingOrbs state="thinking" size={72} tone="warning" />
<ThinkingOrbs state="thinking" size={72} tone="destructive" />
</div>
);
}Listening
level is how loud, from 0 to 1, and widens the rings of listening. Pass a ref to move it on every frame without rendering. Here it is the microphone, which is asked for when the button is pressed.
'use client';
import { useEffect, useRef, useState } from 'react';
import { Button } from '@/components/panelui/button';
import { ThinkingOrbs } from '@/components/panelui/thinking-orbs';
export default function ThinkingOrbsListening() {
const level = useRef(0);
const [live, setLive] = useState(false);
const [refused, setRefused] = useState(false);
useEffect(() => {
if (!live) return;
let frame = 0;
let stopped = false;
let stream: MediaStream | undefined;
let audio: AudioContext | undefined;
navigator.mediaDevices
.getUserMedia({ audio: true })
.then((found) => {
stream = found;
if (stopped) return found.getTracks().forEach((track) => track.stop());
audio = new AudioContext();
const analyser = audio.createAnalyser();
analyser.fftSize = 512;
audio.createMediaStreamSource(found).connect(analyser);
const samples = new Uint8Array(analyser.fftSize);
const read = () => {
analyser.getByteTimeDomainData(samples);
const loud = Math.sqrt(samples.reduce((sum, value) => sum + ((value - 128) / 128) ** 2, 0) / samples.length);
// Rises at once and falls slowly, the way a meter does.
level.current = Math.max(level.current * 0.92, Math.min(1, loud * 5));
frame = requestAnimationFrame(read);
};
read();
})
.catch(() => {
setRefused(true);
setLive(false);
});
return () => {
stopped = true;
cancelAnimationFrame(frame);
stream?.getTracks().forEach((track) => track.stop());
void audio?.close();
level.current = 0;
};
}, [live]);
return (
<div className="flex flex-col items-center gap-6">
<ThinkingOrbs state={live ? 'listening' : 'idle'} size={148} level={level} />
<Button variant="outline" onClick={() => setLive(!live)}>
{live ? 'Stop' : 'Use the microphone'}
</Button>
{refused ? <p className="text-xs text-muted-foreground">The browser did not allow the microphone.</p> : null}
</div>
);
}Handing over
ThinkingOrbs.Relay stands several agents in a row. value is the one with the work; its orb is full size and takes its state, and the rest wait in rest. Change it and the work streams across.
'use client';
import { useEffect, useState } from 'react';
import { ThinkingOrbs, type ThinkingOrbsAgent } from '@/components/panelui/thinking-orbs';
const ORDER = ['plan', 'search', 'write', 'review', 'write'];
const NOTES: Record<string, string> = {
plan: 'Splits the question',
search: 'Finds the passages',
write: 'Drafts the answer',
review: 'Checks every claim',
};
const AGENTS: ThinkingOrbsAgent[] = [
{ value: 'plan', label: 'Planner', note: NOTES.plan, state: 'thinking' },
{ value: 'search', label: 'Researcher', note: NOTES.search, state: 'searching' },
{ value: 'write', label: 'Writer', note: NOTES.write, state: 'writing' },
{ value: 'review', label: 'Reviewer', note: NOTES.review, state: 'solving' },
];
export default function ThinkingOrbsRelayDemo() {
const [at, setAt] = useState(0);
useEffect(() => {
const timer = window.setTimeout(() => setAt((at + 1) % ORDER.length), 3600);
return () => window.clearTimeout(timer);
}, [at]);
return <ThinkingOrbs.Relay className="max-w-xl" agents={AGENTS} value={ORDER[at]!} size={88} label="Answering" />;
}In a conversation
At 28 pixels it sits on a line of text, under the question it is working on.
'use client';
import { useEffect, useState } from 'react';
import { Message } from '@/components/panelui/message';
import { ThinkingOrbs, type ThinkingOrbsState } from '@/components/panelui/thinking-orbs';
const STEPS: { state: ThinkingOrbsState; says: string }[] = [
{ state: 'thinking', says: 'Working out what you mean' },
{ state: 'searching', says: 'Looking through your calendar' },
{ state: 'writing', says: 'Writing it up' },
{ state: 'done', says: 'Moved to Thursday' },
];
export default function ThinkingOrbsMessage() {
const [at, setAt] = useState(0);
useEffect(() => {
const timer = window.setTimeout(() => setAt((at + 1) % STEPS.length), at === STEPS.length - 1 ? 4200 : 2400);
return () => window.clearTimeout(timer);
}, [at]);
const step = STEPS[at]!;
return (
<div className="flex w-full max-w-md flex-col gap-5">
<Message from="user">
<Message.Content>
<Message.Bubble>
<Message.BubbleContent>Find an hour this week for the design review.</Message.BubbleContent>
</Message.Bubble>
</Message.Content>
</Message>
<ThinkingOrbs state={step.state} size={28}>
<ThinkingOrbs.Label>{step.says}</ThinkingOrbs.Label>
</ThinkingOrbs>
</div>
);
}API Reference
ThinkingOrbs
| Prop | Type | Default | Description |
|---|---|---|---|
state | ThinkingOrbsState | 'thinking' | What is being done, which is the shape the swarm takes. Default thinking. |
size | number | 40 | The orb's width and height in pixels, from 16 up. Default 40. |
finish | ThinkingOrbsFinish | 'dots' | dots, links between the near ones, halftone, printed through a screen, trails, which draw the way each has come, or glyphs, typed out in characters. Default dots. |
tone | ThinkingOrbsTone | 'auto' | Its colour. auto is the text colour, with done, error and waiting in their own roles; current is the text colour throughout; the others are that role throughout. Default auto. |
level | number | { current: number } | 0.5 | How loud, from 0 to 1, for listening. Pass a ref to change it on every frame without rendering. Default 0.5. |
speed | number | 1 | How fast it moves: 2 is twice as fast. Default 1. |
count | number | — | How many dots it is made of. Worked out from size when left out. |
interactive | boolean | size >= 40 | Whether the dots lean away from the pointer. Default true from 40 pixels up. |
label | string | — | What a screen reader says when there is no ThinkingOrbs.Label. Default the state's name: "Searching". |
ThinkingOrbs.Label
| Prop | Type | Default | Description |
|---|---|---|---|
shimmer | boolean | — | Whether a highlight sweeps along it. Default on while something is being worked on. |
ThinkingOrbs.Relay
| Prop | Type | Default | Description |
|---|---|---|---|
agents | readonly ThinkingOrbsAgent[] | — | The agents, in the order they stand. |
value | string | — | The value of the one that has the work. Change it and the work streams across. |
size | number | 64 | Each orb's width and height in pixels, or less where the row has no room for it. Default 64. |
finish | ThinkingOrbsFinish | 'dots' | How the orbs are drawn. trails is drawn as dots here. Default dots. |
label | string | 'Agents' | What a screen reader calls the row. Default "Agents". |
Every part also takes the props of the element it renders, and a className.
Notes
Accessibility
The orb is a role="status", so a screen reader announces each change. It says the ThinkingOrbs.Label when there is one, and otherwise label, or the state's own name. The canvas is hidden from it.
Reduced motion
With reduced motion turned on, an orb holds a still of its state and changes to the next at once, and a label changes without rolling.
Cost
Every orb on the page is drawn from one animation frame, and an orb that is scrolled out of view is not drawn. links compares each point with the others, so it is capped at 190 points.
The pointer
From 40 pixels up, the dots lean away from the pointer. interactive={false} turns that off.
Server Components
ThinkingOrbs is a client component. In a file that starts with "use client", write its parts with a dot, as on this page. A Server Component cannot read ThinkingOrbs.Label off the import, so each part is also exported by name: ThinkingOrbsLabel is ThinkingOrbs.Label, and so on for the others.
import { ThinkingOrbs, ThinkingOrbsLabel, ThinkingOrbsRelay } from "@/components/panelui/thinking-orbs"