npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-comment-thread.json --yesComment thread
ProA record's discussion: replies, reactions, resolve, for React and Tailwind CSS. Part of Goop Pro.
This part takes no options of its own: it is set by what you put in it.
What an agent sees
- ReactionBarA row of emoji reactions with their counts, and a button to add one
- defaultReactionChoicesThe emoji the picker offers when the caller names none
import { defaultReactionChoices, ReactionBar } from '@/components/ui/goop/comment-thread';
import { useState } from 'react';
import { CommentThread, type ThreadComment } from '@/components/ui/goop/comment-thread';
const FIRST: ThreadComment = {
id: 'c1',
author: { name: 'Ngozi Ilori' },
time: '2 hours ago',
body: 'The tags come back after a sync on a slow connection.',
reactions: [{ emoji: '👍', label: 'Thumbs up', count: 2 }],
};
function Discussion() {
const [replies, setReplies] = useState<ThreadComment[]>([
{ id: 'r1', author: { name: 'Yuto Sakamaki' }, time: '1 hour ago', body: 'Same here on the Thursday build.' },
]);
const [resolved, setResolved] = useState(false);
const me = { name: 'Teodora Valk' };
return (
<CommentThread
comment={FIRST}
replies={replies}
onReply={(text) =>
setReplies((all) => [...all, { id: `r${all.length + 1}`, author: me, time: 'Just now', body: text }])
}
resolved={resolved}
onResolve={() => setResolved(true)}
onReopen={() => setResolved(false)}
/>
);
}When to use
- A record's discussion: replies, reactions, resolve.
Installation
Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Comment thread on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-comment-thread.json --yesAdd the Goop Comment thread to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { defaultReactionChoices, ReactionBar } from '@/components/ui/goop/comment-thread';
import { useState } from 'react';
import { CommentThread, type ThreadComment } from '@/components/ui/goop/comment-thread';
const FIRST: ThreadComment = {
id: 'c1',
author: { name: 'Ngozi Ilori' },
time: '2 hours ago',
body: 'The tags come back after a sync on a slow connection.',
reactions: [{ emoji: '👍', label: 'Thumbs up', count: 2 }],
};
function Discussion() {
const [replies, setReplies] = useState<ThreadComment[]>([
{ id: 'r1', author: { name: 'Yuto Sakamaki' }, time: '1 hour ago', body: 'Same here on the Thursday build.' },
]);
const [resolved, setResolved] = useState(false);
const me = { name: 'Teodora Valk' };
return (
<CommentThread
comment={FIRST}
replies={replies}
onReply={(text) =>
setReplies((all) => [...all, { id: `r${all.length + 1}`, author: me, time: 'Just now', body: text }])
}
resolved={resolved}
onResolve={() => setResolved(true)}
onReopen={() => setResolved(false)}
/>
);
}- On a record page it stands in the activity column under the record's history (ActivityItem rows), one thread per discussion; a new discussion starts in the page's own Composer (
variant="comment"), whose send adds a thread. - ReactionBar: A comment thread draws one under each comment; on its own it serves any item people react to (a post, an update).
- width, padding, gap, corner, background, text: add no class for these.
API reference
- Each option with its sentence: comment-thread--options.md
| Part | What it is |
|---|---|
| ReactionBar | A row of emoji reactions with their counts, and a button to add one; its props: comment-thread--reaction-bar.md |
| defaultReactionChoices | The emoji the picker offers when the caller names none |
- data-slot values (to select a part by): comment-thread, comment-thread-actions, comment-thread-comment, comment-thread-footer, comment-thread-replies, comment-thread-reply, comment-thread-status, reaction-bar, reaction-picker
CommentThread: every option
import { CommentThread } from '@/components/ui/goop/comment-thread';Options
- comment: ThreadComment — The thread's first comment.
- replies?: readonly ThreadComment[] = [] — The replies under it, oldest first.
- onReply?: (text: string) => void — Called with a reply's words (trimmed, never empty) when the reader sends it; add it to
replies. - onReact?: (commentId: string, reaction: ReactionChoice, reacted: boolean) => void — Called when the reader toggles a reaction on a comment: its id, the emoji, and whether they now react with it.
- reactionChoices?: readonly ReactionChoice[] — The emoji the picker offers; six common ones when left out.
- resolved?: boolean — Resolved (controlled): the thread folded to one line.
- defaultResolved?: boolean = false — Resolved from the start (uncontrolled).
- onResolve?: () => void — Called when Resolve is pressed.
- onReopen?: () => void — Called when the folded line is pressed to open the thread again.
- collapseAfter?: number = 3 — More replies than this and the thread shows its first and last reply with "Show N more" between them; 3 when left out.
- labels?: Partial<CommentThreadLabels> — The words it says, any of them replaced.
- Types: ThreadComment = { id: string; author: CommentAuthor; time: string; dateTime?: string; body: ReactNode; excerpt?: string; reactions?: readonly CommentReaction[] }; ReactionChoice = { emoji: string; label: string }
ReactionBar
A row of emoji reactions with their counts, and a button to add one.
import { ReactionBar } from '@/components/ui/goop/comment-thread';Options
- reactions?: readonly CommentReaction[] = [] — The reactions, in the order shown.
- onReact?: (reaction: ReactionChoice, reacted: boolean) => void — Called when the reader toggles a reaction (a chip, or the picker): the emoji, and whether they now react with it.
- choices?: readonly ReactionChoice[] — The emoji the picker offers; six common ones when left out.
- labels?: Partial<ReactionBarLabels> — The words it says, any of them replaced.
- Types: ReactionChoice = { emoji: string; label: string }; CommentReaction = { count: number; reacted?: boolean }; ReactionBarLabels = { reactions: string; addReaction: string; youReacted: string }
Keyboard
| Key | What it does |
|---|---|
| Tab | Move through each comment's reaction chips and add button, then Reply and Resolve, then the replies' own |
| Enter Space | On a reaction chip: toggle the reader's reaction, the count following; on the add button: open the picker, the focus on its first emoji; on Reply: open the reply box, focused; on Resolve: fold the thread to its one line, focused, said politely; on the folded line: open it again, the focus on Resolve; on Show N more: show every reply, the focus on the first one shown |
| ArrowLeft ArrowRight Home End | In the picker: move along its emoji (wrapping at the ends) |
| Escape | In the reply box: close it, the focus back on Reply; in the picker: close it, the focus back on the add button |
| Cmd Ctrl+Enter | In the reply box: send the reply (the composer's own key) |
Accessibility
- The part itself answers the keys above.
- focus-visible: the browser's own (:focus-visible): write nothing
Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:
| State | Drawn by |
|---|---|
| pressed | the attribute aria-pressed |
Notes for AI
Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.