Collab Screens
Comment threads with @mentions, an activity feed and a version history panel for any record.
Comments
AR Asha RaoInvoice INV-2041 looks right. @Marcus Lee can you confirm the tax line?
ML Marcus LeeConfirmed, 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-uiUsage
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 RaoInvoice INV-2041 looks right. @Marcus Lee can you confirm the tax line?
ML Marcus LeeConfirmed, 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
- MLMarcus Lee changed status to Paid
- ARAsha Rao commented
Sent the reminder to the client.
- ARAsha 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
| Field | Before | After |
|---|---|---|
| Status | paid | |
| Paid at | 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
| Field | Before | After |
|---|---|---|
| Status | paid | |
| Paid at | 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.
| Prop | Type | Default | Description |
|---|---|---|---|
threads | CollabThread[] | required | Comments with their replies. |
currentUserId | string | - | Shows Edit and Delete on this user's own comments. |
canModerate | boolean | - | Shows Delete on everyone's comments. |
onAdd | (input: { body: string; parentId?: string }) => Promise<unknown> | unknown | required | Called 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[] | required | Members matching the @ query. |
title | ReactNode | - | Heading override. |
labels | Partial<CollabLabels> | DEFAULT_COLLAB_LABELS | Override any string. |
MentionTextarea
Also accepts textarea props except onChange and defaultValue.
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | required | Body with mentions as @[Name](user:<id>). |
onValueChange | (body: string) => void | required | Called with the stored form of the body. |
onSearch | (query: string) => Promise<CollabPerson[]> | CollabPerson[] | required | Members matching the query. |
labels | Partial<CollabLabels> | DEFAULT_COLLAB_LABELS | Override any string. |
ActivityFeed
Also accepts section props.
| Prop | Type | Default | Description |
|---|---|---|---|
items | CollabTimelineItem[] | required | Timeline entries, newest first. |
onLoadMore | () => Promise<unknown> | unknown | - | Shows Load more when set. |
hasMore | boolean | - | Whether more entries exist. |
title | ReactNode | - | Heading override. |
labels | Partial<CollabLabels> | DEFAULT_COLLAB_LABELS | Override any string. |
VersionHistory
Also accepts section props.
| Prop | Type | Default | Description |
|---|---|---|---|
versions | CollabVersion[] | required | Versions, 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. |
defaultSelected | number | latest | The version shown first. |
title | ReactNode | - | Heading override. |
labels | Partial<CollabLabels> | DEFAULT_COLLAB_LABELS | Override any string. |
VersionDiff
| Prop | Type | Default | Description |
|---|---|---|---|
changes | CollabFieldChange[] | required | Field, from and to values. |
labels | Partial<CollabLabels> | DEFAULT_COLLAB_LABELS | Override any string. |
className | string | - | Class on the table. |
CommentBody
| Prop | Type | Default | Description |
|---|---|---|---|
body | string | required | Text with stored mentions, rendered as chips. |
className | string | - | Extra classes. |
Billing Screens
Plans, the current subscription, usage, invoices, a wallet and a paywall, ready to compose into a billing page.
Cost Dashboard
AI cost for the admin: spend over time with what the cache saved, spend by model, the top spenders (subject hashes, as the server gives them), and how much of the global day and month caps is used. Data is what signet-server's `observabilityAdminRoutes` returns (`series`, `models`, `top`) plus the global caps from signet-db's `usage("global")`; hand it in as `data`, or give a `fetcher(days)` and the screen loads and retries itself. Money is millionths of a USD. recharts is an optional peer, so this screen has its own export path, `@dapplelight/signet-ui/screens/cost-dashboard`, never the barrel.