Documentation menu
Getting Started
Components
Primitives
- Agent Thinking
- Alert
- Alert Dialog
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Checkbox
- Command
- Command Palette
- Context Menu
- Data Table
- Dialog
- Dropdown Menu
- Empty
- Field
- Glow Cloud
- Input
- Label
- Medication Schedule
- Period Tabs
- Popover
- Rainbow Button
- Scroll Area
- Select
- Selectable Card
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Tag
- Textarea
- Timeline
- Tooltip
- Use Count Up
Charts and metrics
Patterns
- Confirm Button
- Date Picker
- Embedded
- Empty State
- Entity Drawer
- Error Boundary
- Field Row
- File Dropzone
- Form Dialog
- Kv
- List Editor
- List Page
- Live Time
- Mini Table
- Money
- Note Field
- Note Text
- Page Card
- Page Header
- Page Tabs
- Page Toolbar
- Person Cell
- Picture Field
- Print Card
- Range Switcher
- Row Actions
- Search Input
- Search Select
- Selected Box
- Signature Pad
- Status Badge
- Sub Nav Layout
- Suggest Input
- Tab Icons
- Table Footer
- Theme Accent Picker
- Time Picker
- View All Link
Dashboard cards
Advanced
Device frames
Website widgets
Website screens
Website panels
Primitives
Agent Thinking
Shows an AI agent's steps while it works: a shimmering title, a timer and collapsible steps.
import { AgentThinking } from "@/registry/vcare/ui/agent-thinking"
export default function AgentThinkingDemo() {
return (
<AgentThinking
className="mx-auto max-w-md"
active
defaultOpen
activeLabel="Reading the visit"
steps={[
{ id: "1", label: "Read notes and vitals", state: "done" },
{ id: "2", label: "Checked allergies", detail: "Penicillin", state: "done" },
{ id: "3", label: "Drafting the summary", state: "running" },
]}
/>
)
}Installation
npx shadcn@latest add @vcare/agent-thinkingOr install directly from the URL: https://ui.vcarehms.com/r/agent-thinking.json
- Install the dependencies:
npm i lucide-react radix-ui - Add the registry items it uses: utils.
- Copy this file into your project and change the
@/registry/vcare/…imports to your own paths.
components/ui/agent-thinking.tsx
import * as React from 'react';
import { Check, ChevronDown, LoaderCircle } from 'lucide-react';
import { Collapsible } from 'radix-ui';
import { cn } from '@/registry/vcare/lib/utils';
export interface ThinkingStep {
id: string;
label: string;
detail?: string;
state: 'running' | 'done';
}
interface Props {
/** True while the agent is still working: the title shimmers and the timer runs. */
active: boolean;
/** Title while active, e.g. "Thinking". */
activeLabel: string;
/** Title once finished; receives the seconds spent, e.g. "Thought for 4s". */
doneLabel?: (seconds: number) => string;
steps?: ThinkingStep[];
/** Free text the agent reasoned in, shown under the steps. */
children?: React.ReactNode;
defaultOpen?: boolean;
className?: string;
}
/** Reasoning disclosure: a shimmering "Thinking" line with a live timer that opens to the steps taken. */
export function AgentThinking({ active, activeLabel, doneLabel, steps = [], children, defaultOpen = false, className }: Props) {
const [open, setOpen] = React.useState(defaultOpen);
const [seconds, setSeconds] = React.useState(0);
React.useEffect(() => {
if (!active) return;
const timer = setInterval(() => setSeconds((s) => s + 1), 1000);
return () => clearInterval(timer);
}, [active]);
const expandable = steps.length > 0 || !!children;
const title = active ? activeLabel : (doneLabel?.(seconds) ?? activeLabel);
return (
<Collapsible.Root open={expandable && open} onOpenChange={setOpen} data-slot="agent-thinking" className={cn('text-sm', className)}>
<Collapsible.Trigger
disabled={!expandable}
aria-label={title}
className="group/thinking inline-flex items-center gap-1.5 rounded-md py-0.5 text-start outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:cursor-default"
>
<span className={cn(active ? 'text-shimmer' : 'text-muted-foreground')}>{title}</span>
{active && seconds > 0 && <span className="text-xs text-faint tabular-nums">{seconds}s</span>}
{expandable && (
<ChevronDown className="size-3.5 text-muted-foreground transition-transform duration-200 group-data-[state=open]/thinking:rotate-180" />
)}
</Collapsible.Trigger>
<Collapsible.Content className="overflow-hidden data-[state=closed]:animate-[thinking-up_150ms_ease-out] data-[state=open]:animate-[thinking-down_200ms_ease-out]">
<div className="mt-2 ms-1.5 flex flex-col gap-2 border-s ps-3">
{steps.map((s) => (
<div key={s.id} className="flex items-start gap-2">
<span className="mt-0.5 grid size-4 shrink-0 place-items-center text-muted-foreground">
{s.state === 'running' ? <LoaderCircle className="size-3.5 animate-spin" /> : <Check className="size-3.5 text-success" />}
</span>
<span className="min-w-0">
<span className="block text-foreground">{s.label}</span>
{s.detail && <span className="block text-xs text-muted-foreground">{s.detail}</span>}
</span>
</div>
))}
{children && <div className="text-muted-foreground">{children}</div>}
</div>
</Collapsible.Content>
</Collapsible.Root>
);
}Usage
import { AgentThinking } from "@/components/ui/agent-thinking"Exports
AgentThinking
Dependencies
lucide-react@^1.80.0(npm)radix-ui@^1.8.1(npm)@vcare/utils(registry)
Raw item: /r/agent-thinking.json