Conversational Thread with Reactions
A rich conversational thread with time-grouped section headers like 'Today' and 'Yesterday', hand-formatted messages using bold text and lists, and a hover-revealed action bar on assistant messages with copy and thumbs up/down reaction buttons.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its avatar, avatar-initials, button dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/conversational-thread-with-reactions.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/chat/chat12.tsx instead.
Usage
The file also exports chat12Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.
import { Chat12, chat12Demo } from "@/components/blocks/chat/chat12"; export default function Page() { return <Chat12 {...chat12Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| groups | Chat12Group[] | none | Time-grouped sections of messages, e.g. Today/Yesterday. |
| className | string | none | Extra classes for the outer wrapper element. |
Types
export interface Chat12Message { id: string; role: "user" | "assistant"; name: string; avatar?: { src: string; alt: string }; timestamp: string; content: React.ReactNode; copyText: string; } export interface Chat12Group { label: string; messages: Chat12Message[]; }
Behavior notes
- The action bar reveal on assistant messages is pure CSS (opacity-0 group-hover/msg:opacity-100 on a group wrapper), no JS is involved in showing/hiding it.
- The thumbs up/down buttons are real per-message state (useState<Record<id, reaction>>), clicking toggles that message's reaction and highlights the active button.
- The copy button calls navigator.clipboard.writeText with the message's plain-text copyText field and shows a real 'Copied' checkmark for 1.5s via useState + setTimeout, it is not decorative.
- 'Today'/'Yesterday' are static literal group labels supplied as data, never computed from new Date(), so server and client render identically.
- Rich formatting (bold, bullet lists) is hand-authored ReactNode content per message, there is no markdown parser dependency.
More Chat Blocks
View all →rich-prompt-input-with-suggestions
Rich Prompt Input with Smart Suggestions
An AI prompt composer with attachment icons, a model selector, and a grid of clickable prompt suggestion cards.
ai-streaming-response-typewriter
AI Streaming Response with Live Typing
A single AI chat exchange with a skeleton loading state, a word-by-word typewriter reveal, and a stop-generating control.
ai-response-with-cited-sources
AI Response with Cited Sources
A Perplexity-style answer with inline numbered citation markers and an expandable source list below it.
code-generation-chat-with-syntax-highlighting
Code Generation Chat with Syntax Highlighting
A developer chat message with a file-name tab bar, a language badge, illustrative syntax coloring, and a real copy button.
prompt-starter-grid
AI Prompt Starter Grid
A tabbed grid of prompt template cards, filterable by category, each with an icon, title, and description.
ai-agent-profile-card
AI Agent Profile Card
A showcase card for an AI agent with avatar, capability badges, a sample chat preview, stats, and action buttons.