Loading component…
Loading component…
One comment with replies
To reuse this local React demo, copy all files from the Code tab into the same folder, then import CommentThread from ./comment-thread.
import { AssistantMark, CommentThread } from "@/components/ui/comment-thread";
const atlas = { name: "Atlas", avatar: <AssistantMark />, assistant: true };
export function Thread({ messages, me }) {
return (
<CommentThread
messages={messages}
currentUser={me}
assistant={atlas}
onReply={async (text) => (text.includes("@Atlas") ? await api.ask(text) : undefined)}
/>
);
}| Name | Type | Default | Description |
|---|---|---|---|
| messages | ThreadMessage[] | id, author, createdAt, text – assistant replies can add a status line with folding details | |
| currentUser | ThreadAuthor | Author of new replies | |
| assistant | ThreadAuthor | Shown with a thinking state while an answer is on its way | |
| onReply | (text) => ThreadMessage \| Promise<ThreadMessage \| void> \| void | Return a message (or a promise) for the assistant to answer, nothing to just post | |
| onClose | () => void | Shows a close button | |
| title | string | "Comment" | Heading in the gray tray |
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"
@import "tailwindcss"; in your main CSS file.