Facebook Comments
ProNewThe comment thread in Facebook's style: chat bubbles, Like and Reply links, short timestamps and a Log in with Facebook button. A preset of Comments that needs no SDK.
Installation
pnpm dlx shadcn@latest add @viewport/facebook-comments
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| comments* | Comment[]The comments to start with; see `Comments`. | — |
| user | CommentAuthorThe signed-in visitor. Without one, the composer asks for a name. | — |
| sort | "top" | "newest" | "oldest"The order to start in. | "top" |
| pageSize | numberComments shown before "Show more". | 5 |
| onSignIn | () => voidAdds a "Log in with Facebook" button above the guest composer. | — |
| onSubmit | (draft: CommentDraft) => void | Comment | Promise<void | Comment>Called with a new comment or reply. Return a promise to show progress; reject it to show the error. | — |
| onLike | (commentId: string, active: boolean) => voidCalled when the visitor likes or unlikes a comment. | — |
| href | stringAddress of the Facebook page or post the thread belongs to, linked from the footer. | — |
| loading | boolean | — |
| disabled | boolean | — |
| className | string | — |
Accessibility
- Inherits the Comments semantics: `article` per comment, nested lists for replies, a labelled composer form and a live region for new posts.
- Like is a toggle button with `aria-pressed`; the like count on each bubble is read as "18 reactions".
- No Facebook script, iframe or cookie is loaded; the footer link is the only thing that leaves your site.