- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Attachment
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Code Block
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Direction
- Drawer
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Marker
- Menubar
- Message
- Message Scroller
- Native Select
- Navigation Menu
- Pagination
- Popover
- Progress
- Questionnaire
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle
- Toggle Group
- Tooltip
- Trace
- Typography
Dark mode is in. The toggle is under Settings, Appearance.
"use client"
import { useChat } from "@ai-sdk/react"Queue is the agent's todo list. Todos sit in two sections, To do and Completed, and the icon on each todo shows its status. The agent updates the list as it works, so a todo moves from one section to the other when it is done.
Queue is built with Trace with a TraceCollapsible for each section.
Installation#
Queue is built with the Trace component.
pnpm dlx shadcn@latest add trace
Usage#
import {
Trace,
TraceCollapsible,
TraceCollapsibleContent,
TraceCollapsibleTrigger,
TraceIcon,
TraceLine,
TraceTitle,
} from "@/components/ui/trace"<Trace>
<TraceCollapsible defaultOpen>
<TraceCollapsibleTrigger>
<TraceLine>
<TraceIcon>
<ListTodoIcon />
</TraceIcon>
<TraceTitle>2 to do</TraceTitle>
</TraceLine>
</TraceCollapsibleTrigger>
<TraceCollapsibleContent>
<Trace>
<TraceLine>
<TraceIcon>
<CircleIcon />
</TraceIcon>
<TraceTitle>Update the registry snapshots</TraceTitle>
</TraceLine>
<TraceLine>
<TraceIcon>
<CircleIcon />
</TraceIcon>
<TraceTitle>Add tests for the combobox</TraceTitle>
</TraceLine>
</Trace>
</TraceCollapsibleContent>
</TraceCollapsible>
<TraceCollapsible>
<TraceCollapsibleTrigger>
<TraceLine>
<TraceIcon>
<ListChecksIcon />
</TraceIcon>
<TraceTitle>1 completed</TraceTitle>
</TraceLine>
</TraceCollapsibleTrigger>
<TraceCollapsibleContent>
<Trace>
<TraceLine>
<TraceIcon>
<CircleCheckIcon />
</TraceIcon>
<TraceTitle>Add a changeset</TraceTitle>
</TraceLine>
</Trace>
</TraceCollapsibleContent>
</TraceCollapsible>
</Trace>Descriptions#
A todo with a description is a TraceCollapsible that opens to show it. A todo without one stays a TraceLine.
import {
CircleCheckIcon,
CircleIcon,<TraceCollapsible>
<TraceCollapsibleTrigger>
<TraceLine>
<TraceIcon>
<CircleIcon />
</TraceIcon>
<TraceTitle>Fix the focus ring on the select trigger</TraceTitle>
</TraceLine>
</TraceCollapsibleTrigger>
<TraceCollapsibleContent>
It is clipped by overflow-hidden on the field.
</TraceCollapsibleContent>
</TraceCollapsible>AI SDK#
The agent writes its todos with a tool, writeTodos in this example. Each call sends the whole list, so render the last call and skip one whose input is still streaming.
const todos = message.parts
.filter((part) => part.type === "tool-writeTodos")
.filter((part) => part.state !== "input-streaming")
.at(-1)?.input?.todosMap each todo status to a section, an icon and a TraceLine status. Set "running" on the todo in progress only while the chat streams, so its title stops shimmering when the agent stops.
| Todo status | Section | Icon | TraceLine status |
|---|---|---|---|
pending | To do | CircleIcon | none |
in_progress | To do | CircleDotIcon | "running" while the chat streams |
completed | Completed | CircleCheckIcon | none |
Migrating from AI SDK Elements#
If you added Queue from AI SDK Elements, your project has a components/ai-elements/queue.tsx wrapper. Paste this prompt into your coding agent to rebuild it on Trace. Every export keeps its name and props, so the code that uses it keeps working.
Migrate components/ai-elements/queue.tsx from AI SDK Elements to the shadcn/ui Trace component.
Keep every export, with the same name and props, so the code that imports it keeps working. Only change how each part renders.
1. Install Trace: npx shadcn@latest add trace
2. Read https://ui.shadcn.com/docs/ai-elements/radix/queue.md and build Queue the same way.
3. Rebuild each part:
- Queue renders a Trace.
- QueueSection, QueueSectionTrigger and QueueSectionContent render TraceCollapsible, TraceCollapsibleTrigger and TraceCollapsibleContent.
- QueueSectionLabel renders a TraceLine with a TraceIcon and a TraceTitle, like "2 to do".
- QueueList renders a Trace. Drop the ScrollArea.
- QueueItem renders a TraceLine. QueueItemIndicator renders a TraceIcon, QueueItemContent a TraceTitle, and QueueItemDescription a TraceDescription.
- Keep QueueItemActions, QueueItemAction and the attachment parts as they are.
4. Remove the imports the file no longer uses.
5. Run the type checker and fix any errors.API Reference#
See Trace.