CommentThread
Data Display

CommentThread

Threaded discussion for review comments, incident notes, and ticket replies.

CommentThread

CommentThreadProps props
PropTypeDefaultDescription
commentsComment[]—Top-level comments with nested replies.
onReply(parentId: string, body: string) => void—Called when a reply is submitted.
onReact(commentId: string, emoji: string) => void—Called when a reaction is added.
onComment(body: string) => void—Adds a top-level composer under the thread.
currentUserInitialsstring—Initials for the composer's avatar.
maxDepthnumber3Maximum reply nesting before Reply is hidden.
renderActions(comment: Comment) => ReactNode—Extra controls in the header row.
emptyStateReactNode"No comments yet."Shown when comments is empty.

Comment

Comment fields: id (string), author (string), initials?, avatar?, body (ReactNode), time (Date), edited?, isAuthor?, badge?, reactions? (CommentReaction[]), replies? (Comment[]), pending?.

CommentView

Use CommentView to render a single comment outside the full thread context, for example in a one-off notification preview.

CommentViewProps props
PropTypeDefaultDescription
commentComment—The comment to render.
depthnumber0Nesting depth for indentation.
maxDepthnumber3Maximum nesting for the Reply button.
onReply(parentId: string, body: string) => void—Reply handler.
onReact(commentId: string, emoji: string) => void—Reaction handler.
renderActions(comment: Comment) => ReactNode—Header action controls.

CommentComposer

CommentComposerProps props
PropTypeDefaultDescription
valuestring—Controlled textarea value.
onChange(value: string) => void—Change handler.
onSubmit() => void—Called on ⌘/Ctrl+Enter.
onCancel() => void—Called on Escape. Providing the handler also displays a Cancel button.
placeholderstring"Leave a comment…"Textarea placeholder.
initialsstring—Initials for the leading avatar. Omit to drop.
autoFocusboolean—Auto-focus the textarea on mount.
compactboolean—Reduces padding and hides the avatar for inline replies.
submitLabelstring"Comment"Submit button label.
disabledboolean—Disables the textarea and button.
CommentComposer

Examples

Comment thread
Be the first to comment.
Empty state
CommentView standalone
ImportTSX
import { CommentThread, CommentView, CommentComposer } from "@solarius/onset";
import type { Comment, CommentReaction } from "@solarius/onset";