Comment thread
Threaded comments with replies, reactions, mentions, inline edit, and resolve.
npx shadcn@latest add @silicon-ui/comment-threadInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/comment-threadManually
Install the dependencies
npm install lucide-react motionCopy these files into your project
- components/silicon-ui/comment-thread/comment-thread.tsx
- components/silicon-ui/comment-thread/comment-thread.module.css
Add the foundation, once per app, for the design and motion tokens
npx shadcn@latest add @silicon-ui/silicon-foundation
Usage
API reference
| Prop | Type | Default |
|---|---|---|
currentUser*The person writing. Their comments can be edited and deleted. | CommentAuthor | โ |
comments | ThreadComment[] | โ |
defaultComments | ThreadComment[] | [] |
onCommentsChange | (comments: ThreadComment[], event: CommentThreadEvent) => void | โ |
peoplePeople who can be mentioned. Defaults to everyone in the thread. | CommentAuthor[] | โ |
resolved | boolean | โ |
defaultResolved | boolean | false |
onResolvedChange | (resolved: boolean) => void | โ |
titleWhat the thread is about, shown in its header, such as "Hero headline". | ReactNode | โ |
reactionsEmoji offered by the reaction picker. | string[] | DEFAULT_REACTIONS |
placeholder | string | "Reply, or @mention someone" |
maxDepthReplies deeper than this attach to the deepest allowed parent. Defaults to 2. | number | 2 |
nowLabelLabel for comments written now. | string | "Just now" |
labelsWords for localization. Leave out any key to keep its English default. | CommentThreadLabels | โ |
className | string | โ |
Also accepts the props of HTMLAttributes.
Dependencies
- npm
- lucide-reactmotion
- Registry
- silicon-motion-tokens