kuratlielia

Comment Thread

Component 11

About

A nested comment thread with reply threading, emoji reactions, inline edit/delete, @mention autocomplete, and a resolve/reopen toggle for review-style discussions.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Comment Thread to your project and fits it to your theme.

Code

How Comment Thread is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import CommentThread, {
  type ThreadComment,
} from "@/components/ui/comment-thread";
import { useState } from "react";

const currentUser = { id: "u-1", name: "Alex Rivera" };
const people = [
  currentUser,
  { id: "u-2", name: "Priya Shah" },
  { id: "u-3", name: "Marco Dias" },
];

const initialComments: ThreadComment[] = [
  {
    id: "c-1",
    author: { id: "u-2", name: "Priya Shah" },
    body: "Can we tighten up the spacing between the hero title and the subhead? Feels a bit loose on mobile.",
    createdAt: "2h",
    reactions: [{ emoji: "👍", users: ["u-1", "u-3"] }],
    replies: [
      {
        id: "c-2",
        author: { id: "u-1", name: "Alex Rivera" },
        body: "@Priya Shah good catch, I'll drop the gap to 12px and ship a fix.",
        createdAt: "1h",
      },
    ],
  },
  {
    id: "c-3",
    author: { id: "u-3", name: "Marco Dias" },
    body: "Loving the new empty state illustration, nice work team.",
    createdAt: "45m",
    reactions: [{ emoji: "🎉", users: ["u-2"] }],
  },
];

export default function CommentThreadDemo() {
  const [comments, setComments] = useState<ThreadComment[]>(initialComments);
  const [resolved, setResolved] = useState(false);

  return (
    <div className="w-full max-w-xl p-6">
      <CommentThread
        title="Hero section feedback"
        currentUser={currentUser}
        people={people}
        comments={comments}
        onCommentsChange={setComments}
        resolved={resolved}
        onResolvedChange={setResolved}
      />
    </div>
  );
}

Dependencies

More by kuratlielia

View all
  • Activity Heatmap

    Activity Heatmap

    362
  • Image Compare

    Image Compare

    107
  • User Menu

    User Menu

    94
  • Date Range Picker

    Date Range Picker

    63
  • Stats Band

    Stats Band

    55
  • Usage Meter

    Usage Meter

    46
  • Signature Pad

    Signature Pad

    37
  • Timeline

    Timeline

    34