Skip to content

Anchored Comments

Comments pinned to text in a document. The text is highlighted, its card sits in the margin level with it, cards never overlap, and a connector joins the selected one to its text. J and K step through them.

On this page
Used for
  • Doc review
  • Spec feedback
  • Copy edits
  • Contract notes

Examples

Installation

Installation is part of Pro

Pro components install from a licensed registry. The live preview stays open to everyone.

Props

children
ReactNode
The document. Wrap each commented range in <CommentMark id>.
notes
{ id, author, body, meta? }[]
One per mark: who started it and the first comment.
active, onActiveChange
string | null
The selected comment.
renderActive
(note) => ReactNode
What the selected card shows: the whole thread, a reply box.
marginWidth
number
Default300
Width of the margin column.
narrowAt
number
Default720
Below this width the cards go under the text.

Accessibility

  • Each highlight is a toggle button named "Comment 2"; Enter selects its card.
  • J and K move through comments in reading order unless the person is typing; a live region says "Comment 2 of 3".
  • The connector is decorative; the numbers tie a highlight to its card for everyone.

What it handles

  1. 01Highlights each commented range and keeps its card level with it in the margin, pushing cards apart so they never overlap.
  2. 02Brings the selected card level with its text and draws a connector from the text to it.
  3. 03Steps through comments with J and K, scrolls the text into view, and lets go with Esc.
  4. 04Below 720px moves the cards under the text, numbered, with the same numbers on the highlights.

States

First render
Cards sit level with their text; nothing plays
none
Select a comment
Its card moves level with the text, the others make room
180ms ease out
Hover a highlight
The tint deepens
120ms ease out
Reduced motion
Cards jump to place
0ms

Works with

When to use

When to use

  • Reviewing a document, a spec or copy with comments tied to the exact words they are about.
  • Any long text where the reader needs to see which comment belongs to which sentence.

When not to use

  • Comments on an image, a mock or a board: use Canvas Comments.
  • One thread with no text to point at: use Comment.

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 Anchored Comments to my app and wire it to my own data.
  • I need reviewing a document, a spec or copy with comments tied to the exact words they are about. Set that up with the Knowns UI Anchored Comments.
  • Which Anchored Comments props do I need for a minimal setup? Show me a short example.

With the server connected, your assistant calls get_component({ name: "anchored-comments" }) and search_docs({ query: "anchored comments" }). Pro props, full examples and source come back once your license key is in the MCP config.

Need help?

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