The parts
Every AI chat interface is built from the same five parts. Each has its own details to get right.
- A prompt input that grows, attaches files and turns send into stop.
- Messages that stream in without the page jumping.
- Sources and citations, so answers can be checked.
- Agent steps, when the model calls tools or asks for approval.
- Model state: thinking, context usage, errors.
shadcn/ui's base components give you the raw pieces: Textarea, Button, ScrollArea. The chat-specific behaviour is up to you, or a registry that ships it.
Prompt input
- Grows with the text up to a limit, then scrolls.
- Enter sends, Shift+Enter adds a line, and IME composition never sends early.
- Files by button, drag and drop, and paste.
- Send turns into stop while a reply streams.
- Text comes back if sending fails.
Streaming messages
Stream text in without reflowing the whole list. Pin the scroll to the bottom only while the user is already there; if they scroll up to read, leave them be and offer a jump-to-latest button.
- Streaming ChatProA chat where the input morphs into your bubble and the reply streams in word by word, with live markdown, voice dictation and file attachments.
- Chat CardProA conversation that plays itself for a bento tile or landing card: typing dots that hop like WhatsApp and grow into each reply, words that write themselves in, reactions that pop on, and a seamless loop that only runs while on screen.
Sources and steps
Citations
Number citations inline and list the sources under the answer, so a reader can check a claim without leaving it.
Agent steps
When the model calls tools, show each step as it happens and stop for approval before anything that changes data.
- Cited AnswerProAn AI answer that streams in with numbered citation pills while each source slides into the list. A passage panel under the answer shows the quoted text behind the source in focus, and pointing at a pill lifts its source and tints the sentences that rely on it.
- Agent TraceProOne run of an AI agent, step by step: a model picker, Auto / Ask / Plan modes with inline approval, thoughts and tool calls streaming down a filling rail, live time, tokens and cost, and a strip of where the time went.
Model state
Show that the model is working before the first token arrives, and how much of the context window a long conversation has used.
- AI OrbProA glass assistant orb filled with a living mesh gradient of shades that rests, listens, thinks and speaks, reacting to a live voice level.
- Context MeterProHow full an AI model's context window is: a pill whose ring grows as it opens into a breakdown card, with springing arcs and bars, rolling digits, a glow on each new message's tokens, hover to isolate a source, and a Compact action that previews what it frees.
Wiring it up
These components are the interface only. They take text and state as props and call you back, so they work with any model or SDK. With the Vercel AI SDK:
npx shadcn@latest add https://uibrik.com/r/prompt-input.json"use client";
import { useChat } from "@ai-sdk/react";
import { PromptInput } from "@/components/uibrik/prompt-input/prompt-input";
export function Composer() {
const { sendMessage, status, stop } = useChat();
return (
<PromptInput
status={status === "streaming" ? "streaming" : "idle"}
onSubmit={({ text }) => sendMessage({ text })}
onStop={stop}
/>
);
}Questions
- Does shadcn/ui have AI chat components?
- shadcn/ui's base components cover the layout pieces, such as text areas, buttons and scroll areas. Chat-specific parts like a prompt input with attachments, streaming messages and citations come from registries such as uibrik.
- Do these components call an AI model?
- No. They are the interface only. Connect them to any model or SDK: pass the streamed text and state in as props.
- What should a chat prompt input handle?
- Multi-line text that grows, Enter to send and Shift+Enter for a new line, file attachments by button, drag and drop and paste, a stop button while a reply streams, and a disabled state.