Comments for any page: a comment with mentions, links and an edited mark, a hover bar to react, reply or do more, a thread that folds older replies and marks what is new, resolve and reopen, and a composer that mentions people and agents with @.
On this page
- Comments on a task
- Review threads
- Feedback on a doc
- Questions for an agent
- Activity side panels
Examples
One comment
Composer with @mentions
Reactions
Installation
npx knowns-ui@latest add commentPaste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install Comment from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/comment
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add comment
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/use-floating.ts
- components/ui/knowns/tooltip.tsx
- components/ui/knowns/tooltip-utils.ts
- components/ui/knowns/avatar.tsx
- components/ui/knowns/spinner.tsx
- components/ui/knowns/button.tsx
- components/ui/knowns/empty.tsx
- components/ui/knowns/menu.tsx
- components/ui/knowns/skeleton.tsx
- components/ui/knowns/comment/comment.tsx
- components/ui/knowns/comment/comment-utils.ts
- components/ui/knowns/chat-composer/use-autosize.ts
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0, class-variance-authority@^0.7.1.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/comment, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "comment" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.- comments
CommentData[]- The first comment, then the replies, oldest first. body uses @[Name](id) for mentions, [text](url) for links.
- me
string- The viewer's id: Edit and Delete show on their own comments, and their replies never count as new.
- lastReadAt
number- Comments after this time (ms) by others sit under a "N new" divider and never fold away.
- keep
number- Default
3 - Replies that show before older ones fold into "Show N more replies".
- people
CommentAuthor[]- People and agents for the @ picker (agents list after people).
- resolved, onResolve
boolean, (resolved) => void- Shows Resolve, and the collapsed line with Reopen.
- onReply
(body, attachments) => void|Promise- Shows the reply box. Return a promise to keep Send busy until it settles.
- onReact, onEdit, onDelete
(id, ...) => void- Each shows its action in the hover bar or the more menu.
- renderComment
(comment, item) => ReactNode- Draw a comment yourself, e.g. an agent reply; item() gives the default with extra props.
| Prop | Type | Default | Description |
|---|---|---|---|
| comments | CommentData[] | - | The first comment, then the replies, oldest first. body uses @[Name](id) for mentions, [text](url) for links. |
| me | string | - | The viewer's id: Edit and Delete show on their own comments, and their replies never count as new. |
| lastReadAt | number | - | Comments after this time (ms) by others sit under a "N new" divider and never fold away. |
| keep | number | 3 | Replies that show before older ones fold into "Show N more replies". |
| people | CommentAuthor[] | - | People and agents for the @ picker (agents list after people). |
| resolved, onResolve | boolean, (resolved) => void | - | Shows Resolve, and the collapsed line with Reopen. |
| onReply | (body, attachments) => void | Promise | - | Shows the reply box. Return a promise to keep Send busy until it settles. |
| onReact, onEdit, onDelete | (id, ...) => void | - | Each shows its action in the hover bar or the more menu. |
| renderComment | (comment, item) => ReactNode | - | Draw a comment yourself, e.g. an agent reply; item() gives the default with extra props. |
Accessibility
- Each comment is an article named with its author, time and text, mentions read as "@Mara Lind".
- The hover bar is a toolbar that also shows on keyboard focus and is always visible on touch screens.
- The composer is a combobox: the mention picker is a listbox, arrows move, Enter or Tab picks, Esc closes it before it cancels an edit.
- Reaction pills are toggle buttons that say who reacted ("You and 2 others reacted with 👍").
- The new-comments divider is a separator with its count, and the loading state is a status region.
What it handles
- 01Reads mentions, links and citation markers out of a plain body string, so you store text, not markup.
- 02Folds older replies into one row that names who wrote them, and never folds away what the person has not read.
- 03Puts a "2 new" divider before the first reply someone else wrote since the person last read the thread.
- 04Opens a picker of people and agents on @, filtered as you type, picked with arrows and Enter, and stores the pick as a mention.
- 05Sends on Cmd+Enter, edits in place with Esc to cancel, and keeps the hover actions (react, reply, more) reachable by keyboard and on touch.
- 06Resolves a thread to one line with who and when, and reopens it; the comments stay one click away.
States
- First render
- Comments sit in place; nothing plays
- none
- Hover or focus a comment
- The row tints and its action bar fades in
- 120ms ease out
- New reply
- The row slides in under the last one
- 180ms ease out
- Show more replies, show resolved comments
- The rows unfold
- 180ms ease out
- Reduced motion
- Rows and bars appear at once
- 0ms
| State | What moves | Timing |
|---|---|---|
| First render | Comments sit in place; nothing plays | none |
| Hover or focus a comment | The row tints and its action bar fades in | 120ms ease out |
| New reply | The row slides in under the last one | 180ms ease out |
| Show more replies, show resolved comments | The rows unfold | 180ms ease out |
| Reduced motion | Rows and bars appear at once | 0ms |
Works with
When to use
When to use
- Comments on a task, a doc or a design, where people reply, mention each other and agents, react and resolve.
- A side panel or tab of discussion that needs unread, folding and resolve without a chat app.
When not to use
- A live conversation with an assistant: use Chat Composer.
- An agent answering with sources in the thread: use Agent Comment Thread.
- Comments pinned to text in a document: use Anchored Comments.
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI Comment to my app and wire it to my own data.
- I need comments on a task, a doc or a design, where people reply, mention each other and agents, react and resolve. Set that up with the Knowns UI Comment.
- Which Comment props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "comment" }) and search_docs({ query: "comment" }).