Skip to Content

Collab Screens

Comment threads with @mentions, an activity feed and a version history panel for any record.

Comments

  • AR
    Asha Rao

    Invoice INV-2041 looks right. @Marcus Lee can you confirm the tax line?

    • ML
      Marcus Lee

      Confirmed, GST is 18%.

import { useState } from "react"
import { CommentThreads, type CollabThread, type CollabPerson } from "@dapplelight/signet-ui/screens/collab-screens"

function CommentThreadsDemo() {
  const people: CollabPerson[] = [
    { id: "u1", name: "Asha Rao" },
    { id: "u2", name: "Marcus Lee" },
    { id: "u3", name: "Priya Nair" },
  ]
  const [threads, setThreads] = useState<CollabThread[]>([
    {
      id: "c1",
      author: people[0],
      body: "Invoice INV-2041 looks right. @[Marcus Lee](user:u2) can you confirm the tax line?",
      createdAt: "2026-11-10T09:30:00Z",
      replies: [
        {
          id: "c2",
          parentId: "c1",
          author: people[1],
          body: "Confirmed, GST is 18%.",
          createdAt: "2026-11-10T10:05:00Z",
        },
      ],
    },
  ])
  return (
    <CommentThreads
      className="w-full max-w-xl"
      threads={threads}
      currentUserId="u1"
      onSearchPeople={(q) => people.filter((p) => p.name.toLowerCase().includes(q.toLowerCase()))}
      onAdd={({ body, parentId }) => {
        const c = { id: `c${Date.now()}`, parentId, author: people[0], body, createdAt: new Date().toISOString() }
        setThreads((t) =>
          parentId
            ? t.map((x) => (x.id === parentId ? { ...x, replies: [...x.replies, c] } : x))
            : [...t, { ...c, replies: [] }],
        )
      }}
      onEdit={(comment, body) =>
        setThreads((t) =>
          t.map((x) => ({
            ...x,
            body: x.id === comment.id ? body : x.body,
            replies: x.replies.map((r) => (r.id === comment.id ? { ...r, body } : r)),
          })),
        )
      }
      onDelete={(comment) => setThreads((t) => t.filter((x) => x.id !== comment.id))}
    />
  )
}

Installation

npm i @dapplelight/signet-ui

Usage

import {
  CommentThreads,
  ActivityFeed,
  VersionHistory,
} from "@dapplelight/signet-ui/screens/collab-screens"

Data goes in as props shaped like signet-db's createCollab results (or the JSON from collabRoutes); actions come out as callbacks.

import { CommentThreads } from "@dapplelight/signet-ui/screens/collab-screens"
import { addComment, searchPeople, threads } from "./collab"

<CommentThreads threads={threads} onAdd={addComment} onSearchPeople={searchPeople} />

Examples

CommentThreads

Comments

  • AR
    Asha Rao

    Invoice INV-2041 looks right. @Marcus Lee can you confirm the tax line?

    • ML
      Marcus Lee

      Confirmed, GST is 18%.

import { useState } from "react"
import { CommentThreads, type CollabThread, type CollabPerson } from "@dapplelight/signet-ui/screens/collab-screens"

function CommentThreadsDemo() {
  const people: CollabPerson[] = [
    { id: "u1", name: "Asha Rao" },
    { id: "u2", name: "Marcus Lee" },
    { id: "u3", name: "Priya Nair" },
  ]
  const [threads, setThreads] = useState<CollabThread[]>([
    {
      id: "c1",
      author: people[0],
      body: "Invoice INV-2041 looks right. @[Marcus Lee](user:u2) can you confirm the tax line?",
      createdAt: "2026-11-10T09:30:00Z",
      replies: [
        {
          id: "c2",
          parentId: "c1",
          author: people[1],
          body: "Confirmed, GST is 18%.",
          createdAt: "2026-11-10T10:05:00Z",
        },
      ],
    },
  ])
  return (
    <CommentThreads
      className="w-full max-w-xl"
      threads={threads}
      currentUserId="u1"
      onSearchPeople={(q) => people.filter((p) => p.name.toLowerCase().includes(q.toLowerCase()))}
      onAdd={({ body, parentId }) => {
        const c = { id: `c${Date.now()}`, parentId, author: people[0], body, createdAt: new Date().toISOString() }
        setThreads((t) =>
          parentId
            ? t.map((x) => (x.id === parentId ? { ...x, replies: [...x.replies, c] } : x))
            : [...t, { ...c, replies: [] }],
        )
      }}
      onEdit={(comment, body) =>
        setThreads((t) =>
          t.map((x) => ({
            ...x,
            body: x.id === comment.id ? body : x.body,
            replies: x.replies.map((r) => (r.id === comment.id ? { ...r, body } : r)),
          })),
        )
      }
      onDelete={(comment) => setThreads((t) => t.filter((x) => x.id !== comment.id))}
    />
  )
}

MentionTextarea

Thanks @Asha Rao, shipping Friday.

import { useState } from "react"
import { MentionTextarea, CommentBody, type CollabPerson } from "@dapplelight/signet-ui/screens/collab-screens"

function MentionTextareaDemo() {
  const [value, setValue] = useState("Thanks @[Asha Rao](user:u1), shipping Friday.")
  const people: CollabPerson[] = [
    { id: "u1", name: "Asha Rao" },
    { id: "u2", name: "Marcus Lee" },
    { id: "u3", name: "Priya Nair" },
  ]
  return (
    <div className="w-full max-w-md space-y-3">
      <MentionTextarea
        value={value}
        onValueChange={setValue}
        onSearch={(q) => people.filter((p) => p.name.toLowerCase().includes(q.toLowerCase()))}
        placeholder="Write a comment. Type @ to mention someone."
      />
      <CommentBody body={value} />
    </div>
  )
}

ActivityFeed

Activity

  1. ML
    Marcus Lee changed status to Paid
  2. AR
    Asha Rao commented

    Sent the reminder to the client.

  3. AR
    Asha Rao created the invoice
import { ActivityFeed, type CollabTimelineItem } from "@dapplelight/signet-ui/screens/collab-screens"

function ActivityFeedDemo() {
  const items: CollabTimelineItem[] = [
    {
      kind: "change",
      id: "a1",
      at: "2026-11-12T14:20:00Z",
      actor: { id: "u2", name: "Marcus Lee" },
      summary: "Marcus Lee changed status to Paid",
      action: "update",
      changes: [{ field: "status", from: "sent", to: "paid" }],
    },
    {
      kind: "comment",
      id: "a2",
      at: "2026-11-11T09:00:00Z",
      actor: { id: "u1", name: "Asha Rao" },
      summary: "Asha Rao commented",
      comment: {
        id: "c1",
        author: { id: "u1", name: "Asha Rao" },
        body: "Sent the reminder to the client.",
        createdAt: "2026-11-11T09:00:00Z",
      },
    },
    {
      kind: "change",
      id: "a3",
      at: "2026-11-10T08:00:00Z",
      actor: { id: "u1", name: "Asha Rao" },
      summary: "Asha Rao created the invoice",
      action: "insert",
    },
  ]
  return <ActivityFeed className="w-full max-w-xl" items={items} />
}

VersionHistory

Version history

FieldBeforeAfter
Statussentpaid
Paid at(empty)2026-11-12

import { VersionHistory } from "@dapplelight/signet-ui/screens/collab-screens"
import { versions } from "./collab"

function VersionHistoryDemo() {
  return (
    <VersionHistory
      className="w-full max-w-xl"
      versions={versions}
      onRestore={(v) => ({ version: versions.length + 1 + v.version })}
      onUndo={() => undefined}
    />
  )
}

VersionDiff

FieldBeforeAfter
Statussentpaid
Paid at(empty)2026-11-12
import { VersionDiff } from "@dapplelight/signet-ui/screens/collab-screens"
import { versions } from "./collab"

function VersionDiffDemo() {
  return <VersionDiff className="w-full max-w-md" changes={versions[0].changes} />
}

API Reference

CommentThreads

Also accepts section props.

PropTypeDefaultDescription
threadsCollabThread[]requiredComments with their replies.
currentUserIdstring-Shows Edit and Delete on this user's own comments.
canModerateboolean-Shows Delete on everyone's comments.
onAdd(input: { body: string; parentId?: string }) => Promise<unknown> | unknownrequiredCalled for a new comment or reply. A throw keeps the text and shows a retry message.
onEdit(comment: CollabComment, body: string) => Promise<unknown> | unknown-Called when a comment is edited.
onDelete(comment: CollabComment) => Promise<unknown> | unknown-Called when a comment is deleted.
onSearchPeople(query: string) => Promise<CollabPerson[]> | CollabPerson[]requiredMembers matching the @ query.
titleReactNode-Heading override.
labelsPartial<CollabLabels>DEFAULT_COLLAB_LABELSOverride any string.

MentionTextarea

Also accepts textarea props except onChange and defaultValue.

PropTypeDefaultDescription
valuestringrequiredBody with mentions as @[Name](user:<id>).
onValueChange(body: string) => voidrequiredCalled with the stored form of the body.
onSearch(query: string) => Promise<CollabPerson[]> | CollabPerson[]requiredMembers matching the query.
labelsPartial<CollabLabels>DEFAULT_COLLAB_LABELSOverride any string.

ActivityFeed

Also accepts section props.

PropTypeDefaultDescription
itemsCollabTimelineItem[]requiredTimeline entries, newest first.
onLoadMore() => Promise<unknown> | unknown-Shows Load more when set.
hasMoreboolean-Whether more entries exist.
titleReactNode-Heading override.
labelsPartial<CollabLabels>DEFAULT_COLLAB_LABELSOverride any string.

VersionHistory

Also accepts section props.

PropTypeDefaultDescription
versionsCollabVersion[]requiredVersions, newest first.
onRestore(version: CollabVersion) => Promise<unknown> | unknown-Restore the selected version. A throw shows its message.
onUndo(latest: CollabVersion) => Promise<unknown> | unknown-Undo the latest change.
defaultSelectednumberlatestThe version shown first.
titleReactNode-Heading override.
labelsPartial<CollabLabels>DEFAULT_COLLAB_LABELSOverride any string.

VersionDiff

PropTypeDefaultDescription
changesCollabFieldChange[]requiredField, from and to values.
labelsPartial<CollabLabels>DEFAULT_COLLAB_LABELSOverride any string.
classNamestring-Class on the table.

CommentBody

PropTypeDefaultDescription
bodystringrequiredText with stored mentions, rendered as chips.
classNamestring-Extra classes.