Components
Drop-in chat shell composing a scrollable message list with an input composer at the bottom. Supports user/assistant text bubbles, error states, attachment chips, and a centered empty state. Self-contained port from 21st.dev Agent Elements.
npx shadcn@latest add https://21st.dev/r/21stdev/agent-chatLoading preview...
import { AgentChat, type AgentMessage } from "@/components/ui/agent-chat";
const messages: AgentMessage[] = [
{
id: "msg-1",
role: "user",
parts: [{ type: "text", text: "Generate a project summary." }],
},
];
export default function ErrorDemo() {
return (
<div className="w-full h-screen p-4 bg-neutral-50 dark:bg-neutral-950">
<div className="w-full max-w-[680px] h-full mx-auto rounded-xl border border-neutral-200 dark:border-neutral-800 overflow-hidden bg-white dark:bg-neutral-900">
<AgentChat
messages={messages}
status="ready"
onSend={() => {}}
onStop={() => {}}
error={{
title: "Request failed",
message: "The model returned an empty response. Please try again.",
}}
/>
</div>
</div>
);
}