Skip to content
GetUrUI

Comment threads

3 variantsPro
.md

Three comment patterns — threaded replies, inline document comment and @mention composer — with collapsing threads, resolving highlights and a keyboard-driven mention list.

commentsthreadrepliesmentionscollaborationdocumentreviewdiscussion

Threaded replies

threaded.tsx

Replies hang off a guide line, collapse with a spring, likes pop and new replies slide in.

$npx shadcn@latest add @geturui-pro/comment-threads-threaded
PropTypeDefaultDescription
root / repliesThreadComment / ThreadComment[]—{ id, author, initials, time, text, likes, owner? }.
me{ name: string; initials: string }—Author for new replies.
defaultCollapsedbooleanfalseStart with replies hidden.
onReply(text: string) => void—Called when a reply is posted.
classNamestring—Extra classes on the card.

Inline comment

inline.tsx

Comment pinned to a highlight: click the quote to focus the thread, reply in place and resolve to fade it.

$npx shadcn@latest add @geturui-pro/comment-threads-inline
PropTypeDefaultDescription
docTitle / headingstring—Document caption and heading.
before / quote / afterstring—Paragraph text around the highlighted quote.
notes{ author, initials, time, text }[]—Comments on the highlight.
me{ name: string; initials: string }—Author for new replies.
defaultResolved / onResolvedChangeboolean / (resolved: boolean) => void—Resolved state.
classNamestring—Extra classes on the card.

Mention composer

mentions.tsx

Typing @ opens a filtered people list driven by the keyboard; posted comments highlight mentions.

$npx shadcn@latest add @geturui-pro/comment-threads-mentions
PropTypeDefaultDescription
title / placeholderstring—Heading and empty-state text.
people{ handle, name, initials, role }[]—Who can be mentioned.
defaultCommentsPostedComment[]—Existing comments above the composer.
me{ name: string; initials: string }—Author for new comments.
onPost(text: string, mentions: string[]) => void—Called with the handles that were mentioned.
classNamestring—Extra classes on the card.

When to use it

Use it for

  • A discussion under a task, pull request or post: CommentThread shows one root comment with a flat list of replies that collapse.
  • Review notes on a document: InlineDocComment pins notes to a highlighted quote and reports when the thread is resolved.
  • A comment that pulls teammates in: MentionComposer suggests people as you type @ and passes the mentioned handles to onPost.

What it needs from your app

  • Your own storage. New comments are added to local state and handed to onReply, onPost or onResolvedChange; save them there and pass the saved comments back in through root and replies, notes or defaultComments on the next load.
  • The people list for mentions (handle, name, initials, role) from your own user data.

Limits

  • Comment props seed the first render only: changing replies, notes or defaultComments later doesn't replace what is shown, so give the component a new key to load another thread.
  • Replies are one level deep and comment text is plain text. Likes are kept in local state with no callback, and nothing updates in real time across users.

Install the whole set

Installs every comment threads variant at once. Each section above has its own command for a single variant.

Pro installs use your private registry token. Add the @geturui-pro registry once — setup guide. The command works after you get Pro.

$npx shadcn@latest add @geturui-pro/comment-threads

Accessibility

  • Reply toggles and likes expose aria-expanded and aria-pressed; composers have labels and Ctrl+Enter to send.
  • The mention list is a combobox with listbox options driven by arrows, Enter, Tab and Escape.
  • Reduced motion keeps the collapse, resolve and new-comment states but drops the slides and pops.