The layout for a chat UI: a message log that sticks to the bottom while replies stream unless the reader scrolls up, a jump-to-latest button, an empty state with suggestions and a footer.
The source is part of Ballmac UI Pro.
Log in with your licence key to read and copy it here, or install it through the shadcn CLI or the MCP server. You own the code once it is in your project.
$49 once regular price $99for this and every other Pro item. Tax included.Money back if it does not work.
Installation
Get a Pro licence key.
The source is part of Ballmac UI Pro.
Log in with your licence key to read and copy it here, or install it through the shadcn CLI or the MCP server. You own the code once it is in your project.
$49 once
regular price $99for this and every other Pro item. Tax included.Money back if it does not work.Once per project: add the Pro registry and your licence key.
components.json{ "registries": { "@ballmac": "https://ui.ballmac.com/r/{name}.json", "@ballmac-pro": { "url": "https://ui.ballmac.com/r/pro/{name}.json", "headers": { "Authorization": "Bearer ${BALLMAC_LICENSE_KEY}" } } } }.env.localBALLMAC_LICENSE_KEY=your-licence-keyAdd it.
$ pnpm dlx shadcn@latest add @ballmac-pro/ai-chat
Usage
import { Chat, ChatMessages, ChatEmpty, ChatSuggestions, ChatSuggestion, ChatFooter, useChatScroll } from "@/components/ballmac/ai-chat"The full example is in the Code tab above.
Examples
Empty state with suggestions
The source is part of Ballmac UI Pro.
Log in with your licence key to read and copy it here, or install it through the shadcn CLI or the MCP server. You own the code once it is in your project.
$49 once regular price $99for this and every other Pro item. Tax included.Money back if it does not work.
API reference
<ChatMessages>
| Prop | Type | Default |
|---|---|---|
contentClassNameClasses for the inner column that holds the messages (width, gap, padding). | string | — |
labelAccessible name of the log. | string | — |
scrollButtonLabelAccessible name of the jump-to-latest button. | string | — |
<ChatEmpty>
| Prop | Type | Default |
|---|---|---|
iconSmall mark above the title (an icon or logo). | React.ReactNode | — |
titleHeadline, e.g. "How can I help?" | React.ReactNode | — |
descriptionOne line under the title. | React.ReactNode | — |
<ChatSuggestions>
| Prop | Type | Default |
|---|---|---|
onSelectCalled with a suggestion's value when it is clicked. Usually sends it as a message. | (value: string) => void | — |
<ChatSuggestion>
| Prop | Type | Default |
|---|---|---|
valueText passed to onSelect. Defaults to the button's text when children is a string. | string | — |
<ChatFooter>
| Prop | Type | Default |
|---|---|---|
contentClassNameClasses for the inner column (match ChatMessages' width). | string | — |
Also accepts the standard attributes of its root element.
Accessibility
| Key | Action |
|---|---|
| Tab | Focuses the message log (scroll with arrow keys / Page Up / Page Down), then the jump-to-latest button when shown |
| Enter / Space | On a suggestion, sends it through onSelect |
| — | The log is role=log with aria-live=polite; set aria-busy on ChatMessages while a reply streams to avoid announcing every token |
Quality scorecard
Every applicable check passes
Measured in Chromium 153.0.8010.12 on October 19, 2026, on version 1.0.0, across 2 examples.
Passed: Accessibility scan
No serious or critical issues in light and dark, on a phone and a desktop (axe-core 4.13.0, WCAG 2.1 AA and best-practice rules).
Passed: Small screens
No sideways scrolling at 360, 390 or 1280 px wide.
Passed: Reduced motion
No endless animation to begin with.
Passed: Right to left
Mirrors correctly in Arabic, Hebrew, Persian and Urdu layouts (0% of elements off the mirror, limit 15%).
Passed: Clean console
No console errors or React hydration errors while loading.
Passed: Keyboard
5 tab stops, each showing a visible change when it takes focus. 3 documented keys.
Not applicable: Loading, empty and error
Does not show data or take submissions.
For information: Automated tests
No test file of its own yet.
For information: Footprint
3.2 KB of source (gzip) in 1 file. Installs lucide-react, motion.
Automated checks find a subset of problems and do not replace testing with a screen reader and a keyboard in your own app. What they miss.
Use with AI
Layout only: <Chat> (a full-height column) > <ChatMessages> (role=log, auto-scroll) + <ChatFooter>. Put ai-message items inside ChatMessages and a prompt-input inside ChatFooter. It holds no chat state, so any source works (Vercel AI SDK useChat, your own fetch stream). With the shadcn MCP server set up (guide), ask your agent:
Add the Ballmac UI AI Chat (@ballmac-pro/ai-chat) to this project with the shadcn MCP, then use it where it fits.
Use it for
- Building an assistant, support bot or copilot panel from ai-message and prompt-input
- Any log that receives streaming content and should follow the newest line unless the reader scrolls up
- A first-run screen with suggested prompts (ChatEmpty + ChatSuggestions)
Not for
- A single one-off AI answer on a page (use ai-message or streaming-text alone)
- Terminal-style command output (use terminal)
Registry JSON (needs your licence key): https://ui.ballmac.com/r/pro/ai-chat.json
Credits
Covered by the Ballmac UI Pro license.
Pairs well with
AI Message
A chat message with user, assistant and system roles: right-aligned user bubbles, full-width assistant prose, an avatar slot, hover-revealed actions and a hydration-safe timestamp.
Prompt Input
An auto-growing chat input: Enter sends, Shift+Enter adds a line (IME-safe), the send button turns into Stop while streaming, with file attachment chips and a toolbar slot.
Streaming Text
Text that arrives progressively, with a blinking caret while streaming, preserved whitespace, aria-busy for screen readers and an optional typewriter reveal for demos.
Tool Call Card
Shows one agent tool call: the tool name, a pending, running, success or error status with icon and text, duration, and collapsible pretty-printed input and result.