AI chatPro
A chat with streamed answers, model picker, suggestions and stop.
pnpm dlx shadcn@latest add @lode/ai-chatWhat's inside
- Word-by-word streaming
- Stop generating
- Model picker and suggestions
When to use
- Assistants and support bots inside a product.
When not to use
- Comparing models: use the AI playground.
Installation
pnpm dlx shadcn@latest add @lode/ai-chatLands in components/blocks/ai-chat.tsx with sample data you replace with your own. Pro installs use an API key: see CLI and API keys.
The CLI also installs motion, lucide-react and every Lode component it's built from.
Usage
Import it from @/components/blocks/ai-chat after installing. It ships with sample data, so it renders straight away; swap in your own data when you're ready.
import { AiChat } from "@/components/blocks/ai-chat";
export default function Page() {
return (
<main className="mx-auto max-w-6xl p-6">
<AiChat />
</main>
);
}API reference
AiChat
A chat with word-by-word streaming, stop generating, model picker, suggestions and copy. Also the default export. No props: sample data sits at the top of the file, ready to swap for your own.
No props.
Keyboard interactions
| Keys | Action |
|---|---|
| Enter | Send |
| Shift+Enter | New line |
| Tab | Reach model picker, suggestions and copy |
Accessibility
- The message list is aria-live="polite" so answers are announced.
- Copy and stop buttons are labelled.
Motion
- Words stream in; new messages slide up.
Responsive behavior
- Full height of its container; the composer stays pinned.
Performance
- Streaming appends to one message; earlier messages don't re-render.
Notes for AI
- Replace the fake stream with your model's token stream and keep the message shape.
This page as Markdown, for assistants and coding agents:
/blocks/ai-chat/markdownThe full library index for assistants is at /llms.txt.
Related
Lode·229 doc pages·llms.txt