Comment Thread
A thread pinned to a clause or a cell: Enter sends, @ opens the people you can mention, your own comments can be edited or deleted, and resolving folds the thread to one line. CommentsPanel lists every thread with All, Open, Resolved and Mine.
The decision inside it
An agent's reply always says AI
A model's comment is marked AI next to its name, never only by its avatar, so people always know which replies a person wrote.
When to use it
Use Comment Thread for discussion pinned to one thing (a clause, a cell, a frame) with replies, @mentions and resolve. Use CommentsPanel beside a document to list every thread with Open, Resolved and Mine filters. For a chat between people and an agent, use the chat components.
Installation
How you get it
Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.
Use Layro's Comment Thread for this.
Install it: npx shadcn@latest add @layro/comment-thread
(the @layro registry is set up in components.json, with LAYRO_KEY in .env.local)
Import it from @/components/ui/comment-thread.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @layro registry with your CLI token: see the Namespaced tab.
Usage
import { CommentThread, type Comment } from "@/components/ui/comment-thread";
export function ClauseComments({ comments, reply, resolve }: { comments: Comment[]; reply: (body: string) => void; resolve: (done: boolean) => void }) {
return (
<CommentThread
anchor="Clause 4.2"
comments={comments}
currentUserId="michael"
mentionable={[{ id: "olivia", name: "Olivia Martinez" }, { id: "sarah", name: "Sarah Anderson" }]}
onReply={reply}
onResolve={resolve}
/>
);
}API reference
“Copy prompt” above puts a full brief on your clipboard — install command, dependencies, props, and the mistakes an assistant usually makes with this component.
Props
Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.
| Prop | Type | Notes |
|---|---|---|
commentsrequired | Comment[] | Oldest first. The first comment opens the thread. |
resolved | boolean | Folded to the first comment with a "Resolved" summary. |
mentionable | MentionablePerson[] | Who @ can mention. |
currentUserId | string | You, for Edit and Delete on your own comments. |
anchor | string | What the thread is attached to, shown above it ("Clause 4.2"). |
onReply | (body: string) => void | Send a reply. Without it there is no reply box. |
onResolve | (resolved: boolean) => void | Resolve (true) or reopen (false). Without it there is no Resolve button. |
onEdit | (id: string, body: string) => void | Save an edited comment. |
onDelete | (id: string) => void | Delete a comment. |
look | Look | Layered rests the thread in a tray with Resolve in the strip below. Default layered. |
placeholder | string | The reply box's placeholder. Default "Reply…". |
Dependencies
npm packages
clsxlucide-reacttailwind-mergeLayro foundations, installed alongside it
layro-themeavatar-stackStates
All of them are drawn by the component. None is left for you to design.
- Open
- Replying
- Mentioning
- Editing
- Deleting
- Resolved
- Panel
Accessibility
- Keyboard reachable throughout, in visual order
- Focus trapped in overlays, Escape closes them
- Focus returns to whatever opened it
- Live regions announce what changed, not that something did
- Honours prefers-reduced-motion
Responsive behavior
- Sizes to its container, not the viewport
- Usable from 320px up
- Pointer-based interaction, so trackpad and touch both work
- No hover-only affordances
Lifetime access
Every component, and everything we ship next.
- All 232 components, source included
- Every template, and everything released after you buy
- shadcn CLI or download — React 18/19, Tailwind v4
- One payment. No subscription.