The Thread

The <verbb-comments> Element ​

<verbb-comments> is one thread. Its attributes say which thread to draw and how, its properties take the settings that aren't plain text, such as part overrides and sign-in, and the thread's browser events bubble from the element itself.

html
<verbb-comments owner-uri="blog/hello-world" endpoint="https://example.com/actions/comments/api" load-mode="button" sort="top" theme="auto"></verbb-comments>

Attributes ​

AttributeWhat it does
owner-id or owner-uriThe element the comments belong to, by its ID or its URI. One of them is needed, and the element waits until it has one.
site-idThe site, for a multi-site install.
endpointThe Comments data API, such as https://example.com/actions/comments/api. Defaults to /actions/comments/api on the page's own origin.
load-modevisible, the default, loads the thread just before it scrolls into view, button waits for Show comments, and eager loads it straight away, as below.
sortnewest, oldest or top.
themelight, dark, auto or none, as Dark Mode explains.

Each attribute is also a property, as ownerId, ownerUri, siteId, endpoint, loadMode, sort and theme, so your code can set them either way.

Changing owner-id, owner-uri, site-id or endpoint draws the new thread in place of the old one, once however many of them change together. Changing sort re-sorts a thread that has loaded and starts a waiting one again in the new order, and changing theme switches the drawn thread's theme. load-mode is read when the thread starts.

The endpoint attribute is markup, so it isn't trusted to say where Editor's module comes from. The element loads Editor from npm instead, as Rich Comments describes.

Properties ​

PropertyWhat it does
controllerThe thread's controller, with load(), refresh(), openEditor(), setTheme() and the rest, or null before the thread starts.
themeConfigClasses and attributes for the ten controls, covered in Styling.
partsPart overrides, each a function or a registered custom element's name, covered in Part Overrides with Custom Elements.
fieldsCustom field overrides by handle, covered in Field Overrides.
labelsWording to use instead of the site's translations, as below.
loadEditorHow Editor is loaded for rich comments. Defaults to importing @verbb/editor.
authHow the person is identified, from @verbb/comments-core, covered in Signing In.

Setting themeConfig, parts, fields, labels or loadEditor redraws the thread with them. auth is read when the thread starts, so setting it starts the thread again. A property set before registerCommentsWebComponents() runs, such as by a framework that renders the element first, still applies.

js
const thread = document.querySelector('verbb-comments');

thread.themeConfig = {
    primaryButton: { resetClass: true, attributes: { class: 'btn btn-primary' } },
    quietButton: { attributes: { class: 'btn btn-ghost' } },
};

thread.parts = {
    badge: ({ badge, html, defaultRender }) => badge.type === 'verified'
        ? html`<span class="badge badge-success">✓ ${badge.label}</span>`
        : defaultRender(),
};

Settings given to Comments.configure() from @verbb/comments-browser reach the element's thread too, beneath its own properties, which suits settings every thread on the page shares, such as darkSelector.

When the Thread Loads ​

Most visitors to a post never scroll down to its comments, so a thread waits until it's needed before it loads anything. Until then the element has only the heading, the comment count and the space the thread will fill.

loadModeWhen the thread loads
visibleJust before it scrolls into view, about 600 pixels ahead. This is the default.
buttonWhen the visitor presses Show comments (42), which is drawn in the thread's place.
eagerAs soon as the script starts.

A link to a comment, such as #comment-1446, ?comment=1446 or a comment's UID after #comment-, loads the thread straight away whatever its mode, and scrolls to the comment. So does following such a link within the page, while other in-page links, such as a table of contents, leave a waiting thread waiting.

load-mode is read when the thread starts. To load a button thread from a control of your own, such as a drawer's toggle, call the element's controller.load(), which does nothing to a thread that has loaded.

js
document.querySelector('#open-drawer').addEventListener('click', () => {
    document.querySelector('#drawer verbb-comments').controller?.load();
});

The script a page downloads first is small. It finds the threads, draws their waiting state, and imports the renderer when a thread is about to be needed. The comment forms are a separate piece again, imported when someone heads for one, or straight away for a signed-in member, whose form shows at the top of the thread. A bundler that splits code at dynamic import() calls keeps these pieces apart, as Vite and webpack do, and the plugin's own script is built the same way.

If a piece can't load, the thread says so where it would have been, with Try again. That can happen to a tab left open while the plugin is updated, because the pieces have new names, and Try again or reloading the page fixes it. Chrome and other Chromium browsers never fetch a failed piece again on the same page, so there Try again for the thread or the comment form reloads the page once the server answers, and a thread that waited for Show comments then shows straight away. The file tray's Try again loads it again without a reload, so a comment being written stays.

While a thread loads, its waiting state stays exactly where it is, with aria-busy="true" on the loading line, and the heading's count is updated from the response in case a cached page held an old number. A long thread draws its first 45 comments at once and the rest in batches while the browser is idle. A link to a comment, focus moving to one and Load more draw what they need straight away.

Labels ​

Every word the thread shows comes from the site's translations in Craft's comments category, so changing wording per site and language is usually done with a static translation file, as the plugin's Text & Translations explains. labels is for wording that belongs to your JavaScript rather than your Craft site, such as an app on another domain that wants its own tone. It takes the keys below, and wins over the site's translations.

js
document.querySelector('verbb-comments').labels = {
    post: 'Send',
    editorPlaceholder: 'What do you think?',
};
Every label, with its default

Placeholders such as {count} and {name} are filled in by the renderer, so keep them in your wording. A label set to an empty string is ignored, and the site's own wording is used instead.

The keys marked “No” in the last column aren't in Craft's translation list. The renderer uses its own English for them unless you give labels.

KeyDefault textTranslated through Craft
commentCountOne1 commentYes
commentCountOther{count} commentsYes
showCommentsShow commentsYes
showCommentsCountShow comments ({count})Yes
loadingLoading comments…Yes
loadMoreLoad more commentsYes
emptyNo comments yet.Yes
beFirstBe the first to comment.Yes
closedComments are closed.Yes
sortLabelSort commentsYes
sortNewestNewestYes
sortOldestOldestYes
sortTopTopYes
replyReplyYes
replyToReply to {name}…Yes
replyingToReplying toYes
cancelReplyCancel replyYes
cancelCancelYes
postPostYes
postingPosting…Yes
saveSave commentYes
editEditYes
editedEditedYes
deleteDeleteYes
deleteConfirmDelete this comment? This can’t be undone.Yes
likeLikeYes
likesLikesYes
upvoteUpvoteYes
downvoteDownvoteYes
scoreScoreYes
reportReport…Yes
reportTitleReport this commentYes
reportReasonWhat’s wrong with it?Yes
reportDetailsAnything else?Yes
reportDetailsHintOptional. Only moderators see this.Yes
sendReportSend reportYes
reportSentThanks for reporting this. A moderator will take a look.Yes
reportWithdrawnReport withdrawn.Yes
closeCloseYes
moreActionsMore actionsYes
copyLinkCopy linkYes
linkCopiedLink copied.Yes
showRepliesShow repliesYes
hideRepliesHide repliesYes
loadMoreRepliesLoad more repliesYes
guestGuestYes
commentByComment byYes
unavailableComment unavailable.Yes
awaitingApprovalWaiting for approval. Only you can see this until a moderator approves it.Yes
editorPlaceholderAdd to the conversation…Yes
editPlaceholderEdit your comment…Yes
yourCommentYour commentYes
writeSomethingFirstWrite something first.Yes
tooLongToo long by {count} charactersYes
charactersLeft{count} characters leftYes
characterCount{count} of {limit} charactersYes
draftSavedDraft savedYes
draftRestoredRestored your draft from {time}.Yes
discardConfirmDiscard what you’ve written?Yes
discardDiscardYes
uploadInProgressPlease wait for your upload to finish.Yes
joinTitleJoin the conversationYes
signInSign inYes
signInToCommentSign in to comment.Yes
signInOrGuestSign in to comment and hear about replies, or post as a guest.Yes
commentAsGuestComment as a guestYes
postingAsPosting asYes
yourDetailsYour detailsYes
yourNameYour nameYes
yourEmailYour emailYes
notShownPubliclyNot shown publiclyYes
replyEmailsEmail me when someone replies. We’ll ask you to confirm your address first.Yes
followFollowYes
followingFollowingYes
followByEmailFollow by emailYes
errorSomething went wrong. Please try again.Yes
tryAgainTry againYes
moderatorModeratorYes
moderatorViewModerator view.Yes
reviewInCommentsReview in CommentsYes
heldCount{count} heldYes
reportedCount{count} reportedYes
showHeldShow heldYes
hideHeldHide heldYes
approveApproveYes
markSpamMark as spamYes
notSpamNot spamYes
removeRemoveYes
restoreRestoreYes
keepKeepYes
spamSpamYes
gifGIFYes
gifAddAdd a GIFYes
gifSearchSearch GIPHYYes
gifResultsGIFsYes
gifRemoveRemove GIFYes
gifEmptyNo GIFs found.Yes
gifPoweredByPowered by GIPHYYes
gifUnavailableGIFs can’t be loaded right now.Yes
foldedReportsComment marked as inappropriateYes
foldedDownvotesComment hidden due to low ratingYes
showFoldedShow commentYes
authorScoreTotal votes across this user’s commentsYes
commentsCommentsYes
moderationModerationYes
onThisPageon this pageYes
holdHoldYes
removedNoteRemoved · only moderators see thisYes
chooseOptionChoose…Yes
addFilesAdd filesYes
addFileAdd a fileYes
removeFileRemoveYes
retryUploadTry {name} againYes
uploadingUploading…Yes
uploaded{name} uploaded.Yes
uploadFailed{name} didn’t upload.Yes
fileRemoved{name} removed.Yes
uploadLimitsUp to {count} files, {size} each.Yes
uploadLimitUp to {size}.Yes
fileTypeNotAllowed{name} can’t be added here. Choose {types}.Yes
fileTooLarge{name} is larger than {size}.Yes
tooManyFilesYou can add up to {count} files here.Yes
formFailedThe comment form couldn’t load. Please try again.No, labels only
uploadsFailedRemove or try again the files that didn’t upload, so nothing is left out.No, labels only
uploadsUnavailableFiles can’t be added right now.No, labels only

Events ​

The thread's events, such as comments:comment-created and comments:before-submit, bubble from the element, with the controller in event.detail.controller. Events and Validation lists them all with what each one gives, and covers checking a comment before it's posted.

js
thread.addEventListener('comments:comment-created', (event) => {
    analytics.track('Comment posted', { thread: event.detail.instanceId });
});

Pages That Change ​

The thread stops when the element is taken off the page and starts again when it's put back, while moving the element somewhere else on the page keeps the thread as it is, along with anything typed in it. Before Turbo Drive keeps a copy of the page, the thread stops, so the copy Turbo restores later starts afresh, and an element still on the page when Turbo's next page loads starts again. A page swap that morphs the element's contents away, such as Turbo 8's morphing refresh, Datastar or idiomorph, has the same thread drawn again, with its controller, its properties and anything typed in it, though it's smoother to leave the element out of the morph with data-turbo-permanent or data-ignore-morph and an id, as Turbo, Sprig and Datastar shows.

In Frameworks ​

The element works in any framework that renders custom elements. Set owner-uri or owner-id as an attribute, and the object settings, such as themeConfig and auth, as properties, since attributes only carry text. For React and Vue apps, the dedicated React and Vue packages draw parts with your own components and render on the server without a mismatch, so they're usually the better fit.

Last updated: Nov 18, 2026, 12:27 PM