Ballmac UI home

AI Chat 1: full chat app pane

A complete assistant screen: collapsible conversation sidebar, model picker, messages with reasoning and tool calls, streaming replies, copy and regenerate, and a prompt with attachments.

Open in v0 (opens in a new tab)

Installation

$ pnpm dlx shadcn@latest add @ballmac/ai-chat-1

Usage

Example: ai-chat-1-demo.tsx
"use client"

import * as React from "react"

import { AiChat1, type ChatTurn } from "@/components/ballmac/blocks/ai-chat-1/ai-chat-1"

const REPLY = "Here's a short plan: reproduce the failure locally, add a wait for the form's ready state, then run the suite ten times to confirm it's stable."

export default function AiChat1Demo() {
  const [messages, setMessages] = React.useState<ChatTurn[] | undefined>(undefined)
  const [streaming, setStreaming] = React.useState(false)
  const timer = React.useRef<ReturnType<typeof setInterval> | null>(null)
  React.useEffect(() => () => {
    if (timer.current) clearInterval(timer.current)
  }, [])
  return (
    <AiChat1
      className="rounded-xl"
      messages={messages}
      streaming={streaming}
      onStop={() => {
        if (timer.current) clearInterval(timer.current)
        setStreaming(false)
      }}
      onSubmit={(value) => {
        const id = String(Date.now())
        setMessages((m) => [...(m ?? []), { id, role: "user", text: value }, { id: `${id}-a`, role: "assistant", text: "", streaming: true }])
        setStreaming(true)
        let i = 0
        timer.current = setInterval(() => {
          i += 5
          setMessages((m) => m?.map((x) => (x.id === `${id}-a` ? { ...x, text: REPLY.slice(0, i), streaming: i < REPLY.length } : x)))
          if (i >= REPLY.length) {
            if (timer.current) clearInterval(timer.current)
            setStreaming(false)
          }
        }, 30)
      }}
    />
  )
}

Dependencies

Use with AI

A ready-made chat screen driven entirely by props. Map your chat state (for example the Vercel AI SDK's useChat messages) to `messages`, call your API in `onSubmit`, and pass `streaming` while a reply arrives. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI AI Chat 1: full chat app pane (@ballmac/ai-chat-1) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Assistant, copilot or agent products
  • Internal AI tools that need history and model choice

Not for

  • A small embedded chat widget (compose ai-chat, ai-message and prompt-input instead)

Registry JSON: https://ui.ballmac.com/r/ai-chat-1.json

Free to use in personal and commercial projects.