Skip to content

Comment

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
Used for
  • Comments on a task
  • Review threads
  • Feedback on a doc
  • Questions for an agent
  • Activity side panels

Examples

Show

One comment

Composer with @mentions

Reactions

Installation

npx knowns-ui@latest add comment
For Claude Code, Cursor or Codex: installs it and wires the props to your own data.
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
Default3
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

  1. 01Reads mentions, links and citation markers out of a plain body string, so you store text, not markup.
  2. 02Folds older replies into one row that names who wrote them, and never folds away what the person has not read.
  3. 03Puts a "2 new" divider before the first reply someone else wrote since the person last read the thread.
  4. 04Opens a picker of people and agents on @, filtered as you type, picked with arrows and Enter, and stores the pick as a mention.
  5. 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.
  6. 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

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

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" }).

Need help?

Stuck on Comment, or found something off? We read every message.