Comment Thread
Nested comment thread. Pro · Content and social › Social
Installation
npx valyro-cli@latest login
npx valyro-cli@latest add comment-thread
npm install valyro-ui-pro
import 'valyro-ui-pro/styles.css';
import { CommentThread } from 'valyro-ui-pro';
Props
| Prop | Type | Default | |
|---|---|---|---|
value | CommentNode[] | Controlled value; use with onValueChange. | |
defaultValue | CommentNode[] | [] | Initial value when uncontrolled. |
onValueChange | (comments: CommentNode[]) => void | Called with the new value when it changes. | |
currentUser | CommentAuthor | { name: 'You' } | Author of new comments and owner of the composer avatar. |
onReply | (reply: CommentNode, parentId: string | null) => void | Called after a comment is added; parentId is null for top-level comments. | |
onLike | (commentId: string, liked: boolean) => void | Called after a comment's like is toggled, with its new state; the thread already updated the count. | |
maxDepth | number | 3 | Nesting levels that get their own indentation; deeper replies line up with their parent (default 3). |
locale | string | Locale for counts and dates (default: the ThemeProvider's, then the browser's). | |
labels | Partial<CommentThreadLabels> | Overrides for the built-in English text; keys left out keep their defaults. |
Related components
- Post Card — Social post card
- Profile Card — User profile
- Reaction Bar — Likes and reactions
- Article Header — Article header: section, headline, lede, authors and date
- Byline — Byline: authors, published and updated dates, reading time
- Article Figure — Image with caption and photo credit
- Pull Quote — Pull quote with attribution
- Key Points — “Key points” summary block
- Editor Note — Update, correction, disclosure and sponsored-content notes
- Article Toc — Article table of contents that tracks the current section
- Reading Progress — Reading progress bar
- Share Bar — Share: Telegram, VK, X, WhatsApp, email and copy link
Previous: Post Card · Next: Profile Card · All Content and social