Skip to content
Haze UI

Chat thread

An assistant or person conversation: timed bubbles that rise in, a typing indicator and a message box with a send button.

pnpm dlx shadcn@latest add @haze/chat-thread
Open preview in a new tab
Livesmall script

When to use

  • A product has an AI assistant or agent the user talks to
  • A support or sales screen shows a short conversation with a reply box

When not to use

  • The screen lists many conversations to choose from. Use inbox-list.
  • Messages are announcements, not a dialogue. Use notification-stack.

Installation

Add the Haze registry to components.json once, then install Chat thread with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/chat-thread
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
id*string–Base for the message box id.
titlestring"Mira, sales assistant"Visible name of the conversation.
subtitlestring–Line under the title: role or state.
messages{ from: "user" | "assistant"; name: string; text: string; time?: string }[]–Messages, oldest first.
typingbooleantrueShows three dots while the assistant writes.
actionstring"#send"Where the message form posts; empty hides the composer.
placeholderstring"Write a message…"Placeholder and label of the message box.
sendLabelstring"Send"Accessible name of the send button.
typingLabelstring"Mira is writing"Screen-reader text for the typing dots.
classstring–Additional classes on the panel.

Keyboard interactions

Tab
Move to the message box, then to Send.
Enter
Send the message when scripts run. Shift+Enter adds a new line.

Accessibility

  • Messages sit in a list with the log role, and each starts with its sender's name for screen readers.
  • The typing dots are hidden from assistive technology and replaced by a status text.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI component "Chat thread" with `npx shadcn@latest add @haze/chat-thread`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import ChatThread from "@/components/haze/ui/chat-thread.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/ui/chat-thread.md

  • Customize with real content

    Adapt the Haze chat-thread ui for our product. Replace the demo values of these props with our real content: id, title, subtitle, messages, typing, action, placeholder, sendLabel, typingLabel, class. Keep the layout, the heading level rules and these accessibility details: Messages sit in a list with the log role, and each starts with its sender's name for screen readers. The typing dots are hidden from assistive technology and replaced by a status text. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using chat-thread, check it fits: use it when a product has an ai assistant or agent the user talks to; a support or sales screen shows a short conversation with a reply box. Avoid it when the screen lists many conversations to choose from. use inbox-list.; messages are announcements, not a dialogue. use notification-stack.. Alternatives: @haze/inbox-list, @haze/notification-stack, @haze/timeline.

Dependencies

  • npm: @lucide/astro
  • @haze/avatar
  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog