Markup Reference
This page lists every class and data-comments-* attribute the thread draws, and every CSS custom property its stylesheets read. The tables are generated from the package's code, so they always match the version these docs describe. Class Names and CSS Layers explains how to use them.
Each class and attribute is marked Stable or Internal. Stable ones are the parts and states a site would reasonably style or select. They change only in a major release, and the upgrade guide lists any that do. Internal ones are helpers inside a part, listed so you can see them, but free to change in any release, so style the stable element around them instead. A class ending in <value> stands for a family, such as comments__badge--<value> for comments__badge--staff and comments__badge--verified.
The last column says which element carries each one, and where it's first drawn among the states the package's tests draw, such as a member's view of a thread, a guest's or a moderator's. Some only appear in particular states, such as comments__comment--held for a moderator.
Thread
The thread's root, its header, the list, and what's shown while it waits, when it's empty or when it fails.
| Class | Status | Element | First drawn in |
|---|---|---|---|
comments | Stable | <section> | the mount point |
comments__closed-notice | Stable | <p> | a closed thread |
comments__count | Stable | <span> | a member’s view |
comments__empty | Stable | <div> | an empty thread |
comments__folded | Stable | <div> | folded |
comments__folded-label | Stable | <p> | folded |
comments__folded-show | Stable | <button> | folded |
comments__follow | Stable | <button> | a member’s view |
comments__gif--portrait | Stable | <img> | a member’s view |
comments__gif-attribution | Stable | <p> | gifs |
comments__gif-button | Stable | <button> | gifs |
comments__gif-picker | Stable | <div> | gifs |
comments__gif-preview | Stable | <figure> | gifs |
comments__gif-remove | Stable | <button> | gifs |
comments__gif-result | Stable | <button> | gifs |
comments__gif-results | Stable | <div> | gifs |
comments__gif-search | Stable | <input> | gifs |
comments__header | Stable | <header> | a member’s view |
comments__heading | Stable | <h2> | the mount point |
comments__icon | Stable | <svg> | a member’s view |
comments__icon--<value> | Stable | <svg> | a member’s view |
comments__list | Stable | <ol> | a member’s view |
comments__live | Stable | <div> | a member’s view |
comments__load-error | Stable | <div> | a thread that failed to load |
comments__load-more | Stable | <div> | a member’s view |
comments__load-more-button | Stable | <button> | a member’s view |
comments__loading | Stable | <p> | a thread waiting to load |
comments__moderator-bar | Stable | <div> | a moderator’s view |
comments__retry | Stable | <button> | a thread that failed to load |
comments__show-comments | Stable | <div> | the Show comments state |
comments__show-comments-button | Stable | <button> | the Show comments state |
comments__sort | Stable | <nav> | a member’s view |
comments__sort-option | Stable | <button> | a member’s view |
comments__toast | Stable | <div> | a member’s view |
comments__visually-hidden | Stable | <span> | a member’s view |
comments__field-cell | Internal | <div> | a member’s view |
comments__field-required | Internal | <span> | a member’s view |
comments__follow-form | Internal | <form> | a member’s view |
comments__gif-area | Internal | <div> | gifs |
comments__gif-cell | Internal | <div> | gifs |
comments__gif-preview-image | Internal | <img> | gifs |
comments__gif-result-image | Internal | <img> | gifs |
comments__gif-status | Internal | <p> | gifs |
comments__header-main | Internal | <div> | a member’s view |
comments__moderator-bar-actions | Internal | <div> | a moderator’s view |
comments__noscript | Internal | <p> | the mount point |
comments__switch | Internal | <input> | a member’s view |
comments--reserve-<value> | Internal | <section> | the mount point |
Comment
Each comment, from its author and text to its actions, its custom field values, a moderator's review and its replies.
| Class | Status | Element | First drawn in |
|---|---|---|---|
comments__action | Stable | <button> | a member’s view |
comments__actions | Stable | <div> | a member’s view |
comments__author | Stable | <div> | a member’s view |
comments__author-name | Stable | <span> | a member’s view |
comments__author-score | Stable | <span> | folded |
comments__author-score--negative | Stable | <span> | folded |
comments__author-score--positive | Stable | <span> | folded |
comments__avatar | Stable | <span> | a member’s view |
comments__avatar--guest | Stable | <span> | a guest’s view |
comments__avatar--initials | Stable | <span> | a member’s view |
comments__badge | Stable | <span> | a member’s view |
comments__badge--<value> | Stable | <span> | a member’s view |
comments__comment | Stable | <li> | a member’s view |
comments__comment--held | Stable | <li> | a moderator’s view |
comments__comment--highlight | Stable | <li> | a member’s view |
comments__comment--pending | Stable | <li> | a member’s view |
comments__comment--reported | Stable | <li> | a moderator’s view |
comments__content | Stable | <div> | a member’s view |
comments__content-plain | Stable | <p> | a member’s view |
comments__content-rich | Stable | <div> | a member’s view |
comments__date | Stable | <time> | a member’s view |
comments__edited | Stable | <span> | a member’s view |
comments__field-file | Stable | <a> | a member’s view |
comments__field-file--image | Stable | <a> | a member’s view |
comments__field-files | Stable | <span> | a member’s view |
comments__field-link | Stable | <a> | a member’s view |
comments__field-thumb | Stable | <img> | a member’s view |
comments__field-value | Stable | <div> | a member’s view |
comments__field-value--<value> | Stable | <span> | a member’s view |
comments__fields | Stable | <dl> | a member’s view |
comments__gif | Stable | <img> | a member’s view |
comments__menu | Stable | <details> | a member’s view |
comments__menu-item | Stable | <button> | a member’s view |
comments__menu-item--danger | Stable | <button> | a member’s view |
comments__menu-items | Stable | <div> | a member’s view |
comments__menu-toggle | Stable | <summary> | a member’s view |
comments__meta-item | Stable | <span> | a member’s view |
comments__moderation-actions | Stable | <div> | a moderator’s view |
comments__permalink | Stable | <a> | a member’s view |
comments__placeholder | Stable | <p> | a member’s view |
comments__replies | Stable | <div> | a member’s view |
comments__replies-list | Stable | <ol> | a member’s view |
comments__review | Stable | <div> | a member’s view |
comments__review-label | Stable | <p> | a member’s view |
comments__score | Stable | <span> | a moderator’s view |
comments__toggle-replies | Stable | <button> | a member’s view |
comments__vote | Stable | <button> | a member’s view |
comments__vote--down | Stable | <button> | a moderator’s view |
comments__vote--up | Stable | <button> | a member’s view |
comments__vote-count | Stable | <span> | a member’s view |
comments__author-meta | Internal | <div> | a member’s view |
comments__field-name | Internal | <dt> | a member’s view |
comments__field-text | Internal | <dd> | a member’s view |
comments__interactions | Internal | <div> | a member’s view |
comments__menu-group | Internal | <div> | a moderator’s view |
comments__menu-heading | Internal | <span> | a moderator’s view |
comments__vote-label | Internal | <span> | a member’s view |
comments__vote-total | Internal | <span> | a closed thread |
Editor
The comment form, the sign-in card for guests, the guest fields, custom fields on the form and Assets fields' file tray.
| Class | Status | Element | First drawn in |
|---|---|---|---|
comments__cancel | Stable | <button> | a member’s view |
comments__editor | Stable | <form> | a member’s view |
comments__editor--create | Stable | <form> | a member’s view |
comments__editor--edit | Stable | <form> | an edit form |
comments__editor--reply | Stable | <form> | a member’s view |
comments__field | Stable | <div> | a member’s view |
comments__field-error | Stable | <p> | a form with errors |
comments__field-label | Stable | <label> | a member’s view |
comments__form-error | Stable | <p> | a member’s view |
comments__frame | Stable | <div> | a member’s view |
comments__frame--fields | Stable | <div> | a member’s view |
comments__guest-fields | Stable | <fieldset> | a guest’s view |
comments__join | Stable | <section> | a guest’s view |
comments__join-actions | Stable | <div> | a guest’s view |
comments__join-guest | Stable | <details> | a guest’s view |
comments__join-text | Stable | <p> | a guest’s view |
comments__join-title | Stable | <h3> | a guest’s view |
comments__posting-as | Stable | <p> | a member’s view |
comments__submit | Stable | <button> | a member’s view |
comments__upload | Stable | <li> | a file field |
comments__upload--file | Stable | <li> | a file field |
comments__upload--image | Stable | <li> | a file field |
comments__upload-add | Stable | <button> | a member’s view |
comments__upload-remove | Stable | <button> | a file field |
comments__upload-retry | Stable | <button> | a file field |
comments__uploads | Stable | <ul> | a file field |
comments__contextual-editor | Internal | <div> | a member’s view |
comments__editor-fields | Internal | <div> | a member’s view |
comments__editor-fields--above | Internal | <div> | a member’s view |
comments__editor-row | Internal | <div> | a member’s view |
comments__field--checkbox | Internal | <label> | a member’s view |
comments__field--files | Internal | <div> | a member’s view |
comments__field-custom | Internal | <div> | a member’s view |
comments__field-hint | Internal | <span> | a guest’s view |
comments__field-instructions | Internal | <p> | a member’s view |
comments__frame-box | Internal | <div> | a member’s view |
comments__frame-count | Internal | <span> | a member’s view |
comments__frame-count--bad | Internal | <span> | a form with errors |
comments__frame-count--warn | Internal | <span> | a form with errors |
comments__frame-foot | Internal | <div> | a member’s view |
comments__frame-head | Internal | <div> | a member’s view |
comments__frame-icon | Internal | <svg> | a member’s view |
comments__frame-link | Internal | <button> | a form with errors |
comments__frame-meta | Internal | <span> | a member’s view |
comments__frame-notice | Internal | <div> | a member’s view |
comments__frame-notice-text | Internal | <span> | a form with errors |
comments__frame-reply | Internal | <p> | a member’s view |
comments__frame-reply-cancel | Internal | <button> | a member’s view |
comments__frame-reply-text | Internal | <span> | a member’s view |
comments__frame-status | Internal | <span> | a member’s view |
comments__frame-status--bad | Internal | <span> | a form with errors |
comments__frame-status--faded | Internal | <span> | a form with errors |
comments__frame-status-text | Internal | <span> | a form with errors |
comments__join-follow | Internal | <details> | a guest’s view |
comments__label | Internal | <legend> | a member’s view |
comments__ring-bg | Internal | <circle> | a form with errors |
comments__ring-fg | Internal | <circle> | a form with errors |
comments__submit-icon | Internal | <svg> | a member’s view |
comments__submit-keys | Internal | <kbd> | a member’s view |
comments__submit-label | Internal | <span> | a member’s view |
comments__textarea-fallback | Internal | <textarea> | a member’s view |
comments__upload--done | Internal | <li> | a file field |
comments__upload--failed | Internal | <li> | a file field |
comments__upload--uploading | Internal | <li> | a file field |
comments__upload-icon | Internal | <span> | a file field |
comments__upload-limit | Internal | <span> | a file field |
comments__upload-meta | Internal | <span> | a file field |
comments__upload-name | Internal | <span> | a file field |
comments__upload-row | Internal | <div> | a member’s view |
comments__upload-text | Internal | <span> | a file field |
comments__upload-thumb | Internal | <img> | a file field |
verbb-editor__button | Internal | <button> | a member’s view |
Report Dialog
The dialog that opens from a comment's Report… action.
| Class | Status | Element | First drawn in |
|---|---|---|---|
comments__report-dialog | Stable | <dialog> | a member’s view |
comments__report-form | Stable | <form> | a member’s view |
comments__report-reason | Stable | <label> | a member’s view |
comments__report-actions | Internal | <div> | a member’s view |
comments__report-close | Internal | <button> | a member’s view |
comments__report-fields | Internal | <fieldset> | a member’s view |
comments__report-header | Internal | <div> | a member’s view |
comments__report-quote | Internal | <blockquote> | a member’s view |
comments__report-reason-description | Internal | <span> | a member’s view |
comments__report-reason-label | Internal | <span> | a member’s view |
comments__report-title | Internal | <h3> | a member’s view |
Controls
The styling classes of the ten controls themeConfig reaches. resetClass drops these from a control.
| Class | Status | Element | First drawn in |
|---|---|---|---|
comments__button | Stable | <button> | a member’s view |
comments__button--primary | Stable | <button> | a member’s view |
comments__button--quiet | Stable | <button> | a member’s view |
comments__button--secondary | Stable | <button> | a member’s view |
comments__checkbox | Stable | <input> | a member’s view |
comments__input | Stable | <input> | a member’s view |
comments__link | Stable | <a> | a member’s view |
comments__radio | Stable | <input> | a member’s view |
comments__select | Stable | <select> | a member’s view |
comments__textarea | Stable | <textarea> | a member’s view |
State Attributes
The thread's behaviour relies on its data-comments-* attributes rather than its classes. The stable ones are safe for your CSS and scripts to select, such as data-comments-state on each comment, which holds its state (approved, pending, held, reported or placeholder), data-comments-phase on the root as it loads, and data-comments-action on every control that does something. Those on the mount point are written by craft.comments.render() and the React and Vue packages rather than the renderer.
| Attribute | Status | Element | First drawn in |
|---|---|---|---|
data-comments-action | Stable | <button> | a member’s view |
data-comments-adapter | Stable | the mount point | |
data-comments-auto-mount | Stable | the mount point | |
data-comments-control | Stable | <button> | a member’s view |
data-comments-phase | Stable | the mount point | |
data-comments-root | Stable | <section> | the mount point |
data-comments-state | Stable | <li> | a member’s view |
data-comments-theme | Stable | the mount point | |
data-comments-api-version | Internal | the mount point | |
data-comments-body | Internal | <textarea> | a member’s view |
data-comments-collapsed | Internal | <div> | a member’s view |
data-comments-collapsible | Internal | <form> | a member’s view |
data-comments-comment | Internal | <li> | a member’s view |
data-comments-comment-uid | Internal | <li> | a member’s view |
data-comments-config | Internal | the mount point | |
data-comments-count | Internal | the mount point | |
data-comments-depth | Internal | <li> | a member’s view |
data-comments-endpoint | Internal | the mount point | |
data-comments-field | Internal | <input> | a member’s view |
data-comments-folded | Internal | <div> | folded |
data-comments-form | Internal | <form> | a member’s view |
data-comments-gif-action | Internal | <button> | gifs |
data-comments-gif-index | Internal | <button> | gifs |
data-comments-gif-search | Internal | <input> | gifs |
data-comments-host | Internal | a component override’s host | |
data-comments-host-kind | Internal | a component override’s host | |
data-comments-host-name | Internal | a component override’s host | |
data-comments-interaction-mode | Internal | <div> | a member’s view |
data-comments-js | Internal | the mount point | |
data-comments-labels | Internal | the mount point | |
data-comments-load-mode | Internal | the mount point | |
data-comments-moderation-action | Internal | <button> | a moderator’s view |
data-comments-owner-id | Internal | the mount point | |
data-comments-placeholder | Internal | <span> | a thread waiting to load |
data-comments-region | Internal | <div> | a member’s view |
data-comments-replies | Internal | <div> | a member’s view |
data-comments-report-dialog | Internal | <dialog> | a member’s view |
data-comments-root-uid | Internal | <div> | a member’s view |
data-comments-site-id | Internal | the mount point | |
data-comments-slot | Internal | <p> | a member’s view |
data-comments-sort | Internal | <button> | a member’s view |
data-comments-state-badge | Internal | <div> | a member’s view |
data-comments-upload | Internal | <button> | a file field |
data-comments-upload-action | Internal | <button> | a member’s view |
data-comments-upload-field | Internal | <button> | a member’s view |
data-comments-upload-input | Internal | <input> | a member’s view |
data-comments-visual-depth | Internal | <li> | a member’s view |
data-comments-vote | Internal | <button> | a member’s view |
data-comments-width | Internal | <div> | a member’s view |
CSS Custom Properties
The properties the stylesheets read, with their values in the light theme and in the dark theme (which the automatic theme uses while the visitor prefers dark). The plugin's Theming guide explains how to set them. Properties starting --_comments- are internal and aren't listed.
| Property | Light | Dark and auto | Elsewhere |
|---|---|---|---|
--comments-avatar-size | 2.25rem | ||
--comments-color-accent | #0b57d0 | #8ab4f8 | |
--comments-color-avatar-0 | #3b6ea5 | ||
--comments-color-avatar-1 | #8a5a2b | ||
--comments-color-avatar-2 | #2f7d4f | ||
--comments-color-avatar-3 | #8a3f7d | ||
--comments-color-avatar-4 | #b0532a | ||
--comments-color-avatar-5 | #237a7a | ||
--comments-color-avatar-6 | #5a4fa3 | ||
--comments-color-avatar-7 | #6b7a2a | ||
--comments-color-border | #d6d9dd | #43484f | |
--comments-color-control-border | #8b9198 | #70767e | |
--comments-color-danger | #b3261e | #f2b8b5 | |
--comments-color-focus | #0b57d0 | #8ab4f8 | |
--comments-color-held-border | #f2d39b | #6b5428 | |
--comments-color-held-surface | #fff8eb | #33291a | |
--comments-color-held-text | #8a5300 | #f3c77a | |
--comments-color-like | #c4314b | #ff8a9e | |
--comments-color-link | #0b57d0 | #8ab4f8 | |
--comments-color-muted | #5a6068 | #b4b9c0 | |
--comments-color-on-accent | #fff | #10223f | |
--comments-color-on-avatar | #fff | ||
--comments-color-on-toast | #fff | #17191c | |
--comments-color-panel | Not set | #17191c | |
--comments-color-reported-border | #f5c2bd | #74403b | |
--comments-color-reported-surface | #fff1f0 | #3a2422 | |
--comments-color-reported-text | #a8322a | #f2a8a1 | |
--comments-color-scrim | rgb(0 0 0 / 45%) | ||
--comments-color-success | #146c2e | #7dd99b | |
--comments-color-surface | #fff | #1f2226 | |
--comments-color-surface-muted | #f5f6f7 | #2a2e33 | |
--comments-color-text | #1f2328 | #eceef0 | |
--comments-color-toast | #1f2328 | #eceef0 | |
--comments-color-toast-danger | #ff9a93 | #b3261e | |
--comments-color-toast-success | #7dd99b | #146c2e | |
--comments-color-warning | #a85d00 | ||
--comments-control-size | 2.25rem | 2.75rem under @media (pointer: coarse) | |
--comments-font-family | inherit | ||
--comments-font-size | 1rem | ||
--comments-gif-max-size | 15rem | ||
--comments-line-height | 1.5 | ||
--comments-radius | 0.5rem | ||
--comments-reserve | Not set, so each rule’s own fallback applies | ||
--comments-space-1 | 0.25rem | ||
--comments-space-2 | 0.5rem | ||
--comments-space-3 | 0.75rem | ||
--comments-space-4 | 1rem | ||
--comments-space-5 | 1.5rem | ||
--comments-thread-indent | 0.875rem | 0.75rem under @media (max-width: 40rem) |
--comments-reserve sets the height reserved for a thread before it loads, which otherwise comes from an estimate based on its comment count.