Components › Blocks

Comment thread

A thread of comments with a box to add one; ⌘ or Ctrl Enter posts.

Installation

npx plankui@latest add comment-thread

Usage

import { CommentThread } from "@/components/ui/comment-thread";

<CommentThread comments={comments} me={{ name: "Jun Li" }} onPost={addComment} />

API reference

PropTypeDefaultDescription
comments{ id, author, avatar?, dateTime, time, body }[]requiredThe thread, oldest first.
me{ name, avatar? }requiredWho is writing.
onPost(text: string) => void | Promise<void>Called with the new comment; the box clears when it resolves.

View the source on GitHub