Skip to content

FreeIn reviewv1.0.0

Chat Thread

A chat conversation: your messages in the accent, replies on a card, and a typing indicator.
npx shadcn@latest add @vibebox/chat-thread

Controls

<ChatThread />

About

The simplest honest chat surface: it renders what it is given and has no opinion about the model. Compose it with the Prompt Composer.

Use it when

  • An assistant or support chat needs a thread.

Skip it when

  • You need streaming markdown: render that inside each message.

Install

  1. 1Add the VibeBox registry to components.json:
    {
      "registries": {
        "@vibebox": "https://motion.vibeboxph.com/r/{name}.json"
      }
    }
  2. 2Add the component with the shadcn CLI:
    npx shadcn@latest add @vibebox/chat-thread
  3. 3Use it:
    import { ChatThread } from "@/components/vibebox/chat-thread";
    
    <ChatThread accent="#7c5cff" />

AI prompt

Everything an AI coding tool needs to rebuild this component the way it looks here: colours, fonts, the art it draws, props and rules.

Read the prompt
Build the VibeBox Motion component "Chat Thread" (AI and agents) in a Next.js App Router project with Tailwind CSS v4.

What it is
- A chat conversation: your messages in the accent, replies on a card, and a typing indicator.
- The thread of an assistant or a support chat: user messages in the accent colour on the right, replies on a card on the left, and an optional typing indicator that bobs. It is a live region log, so new messages are announced, and every colour comes from the accent and the tokens.

Install
- `npx shadcn@latest add @vibebox/chat-thread`
- Registry: add `"@vibebox": "https://motion.vibeboxph.com/r/{name}.json"` to components.json, then run the command. The source lands in `components/vibebox/chat-thread` and is yours to edit.

Visual spec
- Colours (the VibeBox spectrum, the same in light and dark):
    - --spectrum-1: #00c5fc (cyan)
    - --spectrum-2: #1d6ef0 (blue)
    - --spectrum-3: #5225ed (indigo)
    - --spectrum-4: #e434dc (magenta)
    - --spectrum-5: #fd3aa9 (pink)
    - --spectrum-6: #f98472 (coral)
    - --spectrum-7: #fcbe72 (amber)
- Ink surface (dark): background #05070c, card #0a0d15, text #f5f6fa, muted text #a3abbd, border rgba(255,255,255,0.08).
- Paper surface (light): background #f3f0ea, card #fbfaf7, text #0c0e14, muted text #4a4f5c, border rgba(12,14,20,0.12).
- Fonts:
    - Display and body: Figtree (400, 500, 600, 700), falling back to ui-sans-serif, system-ui.
    - Emphasis: Fraunces italic, for one or two words of a heading.
    - Labels and code: JetBrains Mono (400, 500), uppercase labels with 0.14em tracking.
- Shape: radius 8 to 12px on cards and panels; pills may be fully round. Hairline borders, soft glow instead of heavy shadow.
- Motion: animate transform and opacity only; fast ease-out (cubic-bezier(0.16, 1, 0.3, 1)), 140ms for micro-interactions, 320 to 520ms for reveals.

Art and media
- Built from HTML, CSS and inline SVG only; no image files or video.

Props
- `messages`: `{ role: "user" | "assistant"; text: string }[]`. The conversation, oldest first.
- `typing`: `boolean` (default true). Show the typing indicator after the last message.
- `accent`: `string` (default "blue"). The accent colour: blue, violet, emerald, amber, rose, or any CSS colour. It sets --app-accent on the root, so a parent can set it once for a whole screen.
- `className`: `string`. Merged with cn(); give it a width.

Behaviour and access
- Reduced motion: Nothing animates on its own.
- Keyboard: Every control is a native element in reading order.
- Screen readers: Semantic elements with accessible names; decorative marks are hidden.
- Touch: Targets are 36 px or larger; nothing depends on hover.
- Budget: about 0 KB of JavaScript, WebGL none, GPU none. It pauses while off screen.

Theming
Everything reads `--app-accent` (set by the `accent` prop, or by a parent) and the mode's tokens, so light and dark and any brand colour work without code changes. Pass a named accent or any CSS colour; Launchpad sets it once per app from the client's theme.

Usage
```tsx
import { ChatThread } from "@/components/vibebox/chat-thread";

<ChatThread accent="#7c5cff" />
```

Notes
Add the VibeBox Motion Chat Thread with `npx shadcn@latest add @vibebox/chat-thread`. Use it for the conversation area of an assistant; pass messages from your state. Set the brand colour once with `--app-accent` on a parent (or the `accent` prop). It follows light and dark through the tokens; keep the licence header.

Rules
- Keep the licence header on every installed file.
- Original code only: do not copy components from other libraries, and do not add GSAP.
- Use tokens for colour, type and radius; no hard-coded brand values.
- Server Components by default; `"use client"` only for the island.

Code

1 files
components/vibebox/chat-thread/index.tsx
/**
 * VibeBox Motion · Chat Thread
 * Copyright (c) 2026 VibeBox. Licensed under the VibeBox Motion Free License:
 * https://motion.vibeboxph.com/license
 * Use it in unlimited personal, commercial and client projects.
 * Do not sell or redistribute it as a component, kit, template or builder.
 */
import { cn } from "@/lib/utils";
import { accentStyle } from "@/lib/vibebox/app-accent";

export type ChatMessage = { role: "user" | "assistant"; text: string };
export type ChatThreadProps = { messages?: ChatMessage[]; typing?: boolean; accent?: string; className?: string };

const SAMPLE: ChatMessage[] = [
  { role: "user", text: "Can you move my 3 pm booking to Friday?" },
  { role: "assistant", text: "Friday has two openings: 10:30 and 2:15. Which one suits you?" },
  { role: "user", text: "2:15, please." },
];

/** A conversation: user messages in the accent, assistant messages on a card, an optional typing indicator. */
export function ChatThread({ messages = SAMPLE, typing = true, accent, className }: ChatThreadProps) {
  return (
    <div data-vb="chat-thread" style={accentStyle(accent)} className={cn("flex flex-col gap-2.5 rounded-xl border border-border bg-card p-4", className)} role="log" aria-label="Conversation">
      {messages.map((m, i) => (
        <p
          key={i}
          className={cn(
            "max-w-[82%] rounded-2xl px-3.5 py-2 text-small leading-relaxed",
            m.role === "user" ? "self-end rounded-br-md bg-[var(--app-accent)] text-[var(--app-accent-fg,#fff)]" : "self-start rounded-bl-md bg-muted text-foreground",
          )}
        >
          {m.text}
        </p>
      ))}
      {typing && (
        <span aria-label="The assistant is typing" role="status" className="flex w-fit gap-1 rounded-2xl rounded-bl-md bg-muted px-3.5 py-3">
          {[0, 1, 2].map((d) => (
            <i key={d} className="size-1.5 rounded-full bg-muted-foreground motion-safe:animate-[vb-chat-dot_1.2s_ease-in-out_infinite]" style={{ animationDelay: `${d * 0.16}s` }} />
          ))}
          <style href="vb-chat-dot" precedence="vb">{"@keyframes vb-chat-dot { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }"}</style>
        </span>
      )}
    </div>
  );
}

Props

PropTypeDefaultDescription
messages{ role: "user" | "assistant"; text: string }[]—The conversation, oldest first.
typingbooleantrueShow the typing indicator after the last message.
accentstring"blue"The accent colour: blue, violet, emerald, amber, rose, or any CSS colour. It sets --app-accent on the root, so a parent can set it once for a whole screen.
classNamestring—Merged with cn(); give it a width.

Accessibility and motion

Keyboard
Every control is a native element in reading order.
Screen readers
Semantic elements with accessible names; decorative marks are hidden.
Touch
Targets are 36 px or larger; nothing depends on hover.
Reduced motion
Nothing animates on its own.

Edge cases and limits

  • Long words wrap inside the bubble.
  • Messages are plain text: render rich content by passing your own component in place of this one.
  • A vertical timeline with two ticked steps, one spinning step and one queued step

    A timeline of what an agent is doing: done steps ticked, the running one spinning, the rest queued.

    AI and agents · Server

  • A rounded prompt box with a model chip at the bottom left and an accent send button

    A prompt box that grows with its text, with a model chip and a send button that wakes when there is text.

    AI and agents · CSS

  • A collapsed card with a tool name, a status dot and a chevron, opening to arguments and a result

    A tool call an agent made: name and status on a line, arguments and result under a disclosure.

    AI and agents · Server

↑ ↓ to move↵ to openesc to close