Components for AI chat and agent apps
Prompt input, streamed answers, tool calls, approvals, a model picker, a context meter, response branches and a voice orb: React parts for chat and coding-agent interfaces.
They are built for runs that stream, take a while and may be stopped halfway: output grows without throwing the reader around, finished steps fold away, and a person can approve or reject before a tool runs. Each one comes with a live demo, an @karaui install command and its source.
Conversation
The composer, the messages and the controls under each reply: type a prompt or start from a suggestion, lay out each turn, copy or rate an answer, and step between regenerated versions.
Prompt Input
The text box where people talk to your agent: it grows with the draft up to a row limit, sends on Enter with Shift+Enter for a new line, offers a model picker and a prompt action menu, and swaps send for stop during a reply.
Prompt Suggestions
Suggested prompt cards or chips (`PromptSuggestions`) that stagger in on first reveal, filter and highlight as the composer text changes via `query`, reflow with spring layout, move with arrow keys and hand the chosen prompt to `onSelect` — built for empty-chat welcome screens above a PromptInput.
Message
Building blocks for one chat transcript row: Message, MessageGroup, MessageAvatar, header, content and footer slots, a live marker and a typing indicator. A freshly sent row can pop up once from its trailing corner.
Message Bubble
The visible surface of a single chat message: six tones from solid to danger, start or end alignment inherited from its Message row, tight bubble groups, a line-clamped show-more toggle, and room for links or buttons inside.
Message Actions
Assistant message action row (`MessageActions`) with copy that morphs into a drawn check, regenerate that spins (continuously while its promise runs), exclusive thumbs up/down that pop in filled, a thumbs-down reason popover with toggle chips and comment, share and a more menu; reveals on message hover or focus and stays visible on touch or with `visibility="always"` for the last message — a standalone, richer counterpart to StreamingResponse's built-in actions.
Branch Navigator
Version switcher for regenerated or edited messages: `Branches` shares a controlled or uncontrolled index, `BranchContent` cross-fades and slides the active version in from the direction you navigated, and `BranchNavigator` renders a "‹ 2 / 3 ›" control with a rolling counter, arrow/Home/End keys and live announcements, usable standalone too.
Message Scroller
A scroll container for chat transcripts that stays pinned to the newest streamed text only while the reader sits near the bottom, stops following once they scroll up, and can add a rail for jumping between messages.
Answers and sources
Show a reply while it is still being written, generate an image in place, and link each claim to the page it came from.
Streaming Response
Wraps an assistant answer during and after streaming: content renders as it arrives, then copy, retry and thumbs up or down appear, along with a collapsible footer listing the sources behind the answer.
Image Generation
A placeholder for AI images that reserves the final aspect ratio up front, moves through queued, generating and refining stages with a dither pattern and a clearing blur, then shows your image, video or canvas, with retry on failure.
Citations
Numbered markers you drop into an answer's text, linked to a source list that opens and closes, fills in row by row and shows each site's favicon, title and domain, plus a stacked-favicon summary for compact footers.
Progress and plans
Let people know the agent is busy, show the task list it is working through, and keep a readable log of what it did, with no made-up percentages.
Agent Loading States
Three ways to say an agent is busy: ThinkingShimmer sweeps light across a status line, AgentProgress pairs an activity glyph and verb with a running timer, and ReasoningText rotates phrases with cascade, swap or scramble transitions.
Todo List
Shows the plan an agent is working through: each task carries a pending, in-progress, completed or cancelled mark that morphs between states, optional progress and detail, a done count in the header, and a panel that can fold away when all is finished.
Agent Activity
One feed for everything an agent does while it works: free text, reasoning steps, web searches with results, read, edit and run tool calls, or compact trace entries, shown alone or interleaved in order, then folded into a one-line summary.
Tool output and code
Display command output, generated code and file diffs as they stream, with copy buttons, and fold output and diffs away once a step finishes.
Tool Result
Shows what a tool call returned: a header with the tool, title and a running, success, error or cancelled status, a capped log that tracks terminal output or a highlighted response body, retry and copy actions, and a short summary once done.
Code Block
Displays code while an agent is still writing it: highlighting for TypeScript, TSX, JSON, bash, diff or plain text, line numbers, emphasis on chosen lines, a height cap that trails new output, optional wrapping and a copy button that confirms.
File Diff
Shows what an agent changed in a file: added, removed and context lines with old and new numbers and syntax colors, rows that stream in while the edit lands, running plus and minus counts, a copy button and an optional collapse once complete.
Approvals
Stop before a risky tool call or put a question to the user, then keep their answer visible in the run history.
Tool Approval
Asks a person before an agent runs a tool: it lists the call's parameters, can show the code or command to be executed, lets them approve a single run, grant standing access or deny, then follows the call through running, complete or error.
Approval Card
Pauses an agent to get a decision from a person: walk them through single-choice, multi-choice or write-in questions step by step, or ask them to approve, request changes or reject, then shrink to a record of what they chose.
Model and context
Let users choose which model handles the run and see how much of its context window is already used, with an optional compact action.
Model Selector
Searchable AI model picker (`ModelSelector`) that morphs open from its trigger with models grouped by provider, generic geometric provider glyphs, vision/tools/reasoning/fast capability badges, context size, relative cost dots, a New tag and a gliding active row with full keyboard navigation; a richer standalone alternative to PromptInput's compact model select, controlled or uncontrolled.
Context Meter
Token usage indicator (`ContextMeter`) whose compact ring and "42k / 200k" readout expand on hover or click into a breakdown bar of system, conversation, files and tool segments in chart colors, turning warning then critical near the limit and offering an async "Compact conversation" action; drops into PromptInput's `leadingAction` slot.
Voice
Record speech and turn it into a prompt, or show an animated orb that reacts to listening, thinking and speaking.
Voice Input
A mic button that morphs into a recording pill with a live Web Audio waveform, elapsed timer, cancel and confirm actions, a shimmering transcription state, and graceful permission-denied fallback.
Voice Orb
Audio-reactive orb for voice mode whose blurred --chart and --primary color blobs orbit inside a glossy sphere and swell with a 0..1 level prop, easing between idle breathing, listening ripples, a circling thinking arc and churning speaking motion, with a simulate mode that synthesizes speech-like levels and a gentle opacity pulse under reduced motion; pairs with VoiceInput for capture.
Workspace and history
The frame around a chat: a sidebar for projects and files, a searchable list of past conversations, a side panel for generated artifacts, and a full chat app that puts them together.
Chat App
A full agent chat to start from: an app shell whose docked sidebar folds off-canvas when its own container gets too narrow, filled with the workspace tree, transcript, streamed answers, plans, approvals, tool output, code, diffs, images, sources and the composer.
AI Sidebar
A file-tree sidebar for agent workspaces: folders and projects expand, files and bookmarks open, rows move by drag, keyboard or menu with rollback when your save fails, F2 renames in place, and long names truncate cleanly.
Conversation History
Chat history sidebar list grouped into Pinned, Today, Yesterday, Previous 7 days and Older from a now read after mount, with search, a spring-gliding active highlight, hover or focus row actions to pin, rename in place through InlineEdit and delete with a slide-out exit while neighbours glide up, and new chats that drop in at the top with a streaming title caret.
Artifact Panel
Side canvas that slides open beside a chat (its width eases so the conversation reflows smoothly) to show a generated artifact, with a version switcher whose label rolls by direction, Preview/Code tabs rendering code through CodeBlock, copy, download and close actions, a shared-layout expand into a fullscreen overlay, cross-fading content between versions and a skeleton while a new version generates.