Look and Feel

Styling ​

A thread draws with Comments' own stylesheet, which works as it is and suits most sites with a few changes. Work through the options in order and stop at the first that does what you need. Design tokens change colours, sizes and spacing. themeConfig puts your design system's classes on Comments' buttons and inputs. Your own CSS reaches anything else through stable class names.

Importing the Stylesheets ​

Import the stylesheets once, such as in your app's entry or, in Next.js, the root layout. Editor's stylesheet is for rich comments.

tsx
import '@verbb/comments-browser/css/comments.css';
import '@verbb/editor/styles';

The browser package has three stylesheets, so you can choose how much of Comments' look you start from.

StylesheetWhat it holdsLoaded for
css/comments.cssThe base and the theme togetherThe Light, Dark and Auto themes
css/comments-base.cssOnly what the thread needs to work, such as visually hidden text, reserved space, collapsed replies and the editor's swapThe None theme
css/comments-theme.cssOnly the lookA site that brings its own base

The base rules target data-comments-* attributes rather than classes, so even with the None theme and every class restyled, the thread still works. For a design that starts from scratch, choose the none theme and style the stable classes yourself.

The theme prop and provider setting decide which theme a thread draws in, as Dark Mode describes. With theme="none", import comments-base.css in place of comments.css.

Tokens First ​

The thread's colours, radii, spacing and type are CSS custom properties, such as --comments-color-accent and --comments-radius. Set them on .comments in your own stylesheet to change every thread at once.

css
.comments {
    --comments-color-accent: #7c3aed;
    --comments-radius: 0.75rem;
}

The tokens sit in a cascade layer of their own, so your declaration wins whichever file loads last, with no !important. The plugin's Theming guide describes what each token styles.

Every token, with its value in each theme
PropertyLightDark and autoElsewhere
--comments-avatar-size2.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-panelNot set#17191c
--comments-color-reported-border#f5c2bd#74403b
--comments-color-reported-surface#fff1f0#3a2422
--comments-color-reported-text#a8322a#f2a8a1
--comments-color-scrimrgb(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-size2.25rem2.75rem under @media (pointer: coarse)
--comments-font-familyinherit
--comments-font-size1rem
--comments-gif-max-size15rem
--comments-line-height1.5
--comments-radius0.5rem
--comments-reserveNot set, so each rule’s own fallback applies
--comments-space-10.25rem
--comments-space-20.5rem
--comments-space-30.75rem
--comments-space-41rem
--comments-space-51.5rem
--comments-thread-indent0.875rem0.75rem under @media (max-width: 40rem)

themeConfig Second ​

Apps built on a design system, such as Bootstrap, DaisyUI or a component library of their own, usually want that system's button and form classes on Comments' controls rather than a restyled copy of Comments' own. themeConfig adds classes and attributes to the ten controls design systems standardise, and can drop Comments' styling classes from them so the two don't compete.

tsx
import { CommentsProvider, type ThemeConfig } from '@verbb/comments-react';
import type { ReactNode } from 'react';

const themeConfig: ThemeConfig = {
    primaryButton: { resetClass: true, attributes: { class: 'btn btn-primary btn-sm' } },
    secondaryButton: { resetClass: true, attributes: { class: 'btn btn-outline-secondary btn-sm' } },
    quietButton: { attributes: { 'data-track': 'comments' } },
    input: { attributes: { class: 'form-control' } },
    textarea: { attributes: { class: 'form-control' } },
};

export function CommentsSettings({ children }: { children: ReactNode }) {
    return <CommentsProvider endpoint="https://cms.example.com/actions/comments/api" themeConfig={themeConfig}>{children}</CommentsProvider>;
}

Post and the other main buttons get btn btn-primary btn-sm in place of Comments' button styling, Cancel and the other secondary buttons get the outline style, each comment's text actions gain a data-track attribute for your analytics, and the guest fields and comment box gain form-control alongside their own classes.

A thread's own themeConfig prop merges over the provider's, control by control and attribute by attribute, so one thread can add a title to its Post button without repeating the provider's classes. A new themeConfig redraws the thread in place, and writing it inline is fine, because the thread compares what it holds.

The Controls ​

Each control follows how it looks rather than its tag, so Sign in is a primaryButton and Review in Comments a secondaryButton, though both are links.

ControlWhere it appearsClasses resetClass drops
primaryButtonPost, Reply and Save, the sign-in card’s Sign in, the report dialog’s submit, and a moderator’s main decision (Approve or Keep)comments__button, comments__button--primary
secondaryButtonCancel, Show comments, Load more comments and replies, Try again, Follow, the sign-in card’s Comment as a guest and Follow by email, Review in Comments, adding files to an Assets field, and a moderator’s other decisionscomments__button, comments__button--secondary
quietButtonThe text actions on each comment (Like, upvote and downvote, Reply and the ··· toggle), the sort options and Show repliescomments__button, comments__button--quiet
inputGuest name and email, and text, email, number, URL and date custom fieldscomments__input
textareaThe plain comment box, the report dialog’s details and multi-line custom fields. Rich mode’s editor follows the CSS custom properties insteadcomments__textarea
selectDropdown and multi-select custom fieldscomments__select
checkboxThe reply-email opt-in, and checkbox and lightswitch custom fieldscomments__checkbox
radioThe report reasons and radio custom fieldscomments__radio
linkThe link around each comment’s date, which is its permalink. Links inside a comment’s text are reached with .comments__content a insteadcomments__link
avatarEvery avatar, on comments and beside the editorcomments__avatar

Each control's element also carries data-comments-control with the control's name, so your CSS and tests can find it whatever classes it has.

The Style Comments with Tailwind or a Design System user guide puts a design system's classes on the controls step by step, alongside the class names and CSS layers.

attributes and resetClass ​

Each control takes two keys. attributes is merged onto every element of that control. Its class, a string or an array, is added to Comments' classes, and title, aria-label and your own data-* attributes are added or replaced. Those are the only attributes it can set, because the script manages the rest, such as id, name, type, disabled, href and the aria-* attributes it uses, and because anything else could run script or change what a control does. data-comments-* attributes are the script's own too. An unknown control name, a protected attribute or a value that isn't text, a number, true, false or a list of classes logs a warning in the browser console and is left out.

resetClass: true drops Comments' styling classes from the control, the ones in the table's last column, before your class is added. The element keeps its identifying class, such as comments__submit on Post, which carries only layout, and every data-comments-* attribute, so the Markup Reference, your CSS and the script still find it, and busy and disabled states still show through the base stylesheet. Without resetClass, your classes sit alongside Comments' own.

A part override component that draws a button or link of its own can give it the same classes as Comments' controls, through its controlAttributes(name) prop.

Class Names Third ​

When a token or themeConfig doesn't reach what you want to change, every element the thread draws has a comments__* class you can style from your own CSS, Tailwind's @apply or a design system's selectors.

Every class the thread draws is listed in the Markup Reference, each marked stable or internal.

  • Stable classes are the parts and states a site would reasonably style, such as comments__comment, comments__author-name, comments__content, comments__actions and comments__replies, and state modifiers such as comments__comment--held and comments__comment--highlight. They change only in a major release, and the upgrade guide lists any that do.
  • Internal classes are layout helpers inside a part, such as the editor frame's rows and the header's inner wrapper. They're listed so you can see them, but they can change in any release, so style the stable class around them instead.

The package's markup/classes.json holds the same list as data, for tooling of your own.

Comments' own rules use one class each, plus a state modifier where it needs one, so a rule of yours wins with one more class or by loading after Comments' stylesheet.

css
.comments .comments__author-name {
    font-weight: 600;
    text-transform: uppercase;
}

Controls, such as buttons and inputs, take their look from their styling classes alone, such as comments__button--primary. If your design system already styles buttons, putting its classes on Comments' controls with themeConfig is usually simpler than restyling Comments' own.

The thread's behaviour relies on its data-comments-* attributes rather than its classes, so restyling any element, or hiding one, can't stop anything working. Some of those attributes are stable too, such as data-comments-state on each comment and data-comments-action on each control, so your CSS and scripts can rely on them. The Markup Reference lists them.

css
/* Comments waiting for approval, which only their authors and moderators see. */
.comments__comment[data-comments-state='pending'] > article {
    opacity: 0.8;
}

Tailwind and Cascade Layers ​

Comments' design tokens, the --comments-* custom properties, sit in a cascade layer of their own, comments-tokens. Any declaration of them in your ordinary stylesheet wins over that layer, whatever its specificity and whichever file loads last, so overriding a token never needs !important.

Comments' other rules aren't in a layer, which keeps them safe from a site's broad element styles. That matters for sites whose own CSS is layered, such as anything built with Tailwind CSS, because CSS outside a layer beats CSS inside one. Tailwind's utilities and @apply rules would lose to Comments' rules, and Tailwind's preflight couldn't reset the thread either. The fix is to put Comments' stylesheet in a layer of its own, ordered between your base styles and your components.

Declare the order of your layers, then import Comments' stylesheet into its layer. With Tailwind CSS 4, that's at the top of your main stylesheet:

css
@layer theme, base, comments, components, utilities;

@import 'tailwindcss';
@import '@verbb/comments-browser/css/comments.css' layer(comments);
@import '@verbb/editor/styles' layer(comments);

Tailwind's preflight in base leaves the thread alone, and your components and utilities win over Comments' rules, so @apply on the stable classes works as you'd expect.

css
@layer components {
    .comments__heading {
        @apply text-2xl font-semibold tracking-tight;
    }

    .comments__badge--verified {
        @apply bg-emerald-50 text-emerald-700;
    }
}

Every starter imports its stylesheets this way. Editor's stylesheet, for rich comments, goes in the same layer. The Style Comments with Tailwind or a Design System user guide builds a styled thread this way step by step.

Import the stylesheets this way in place of the plain imports above, in your main CSS file rather than from a component.

Dark Mode ​

Every thread has a theme, light, dark, auto or none, from its theme prop or the provider's, and light when neither gives one. auto follows the visitor's own light or dark preference from their system, and none draws no look at all, leaving it to your CSS. A new theme switches the drawn thread in place.

Many apps put a class or attribute on <html> when a visitor turns dark mode on, such as <html class="dark">. Give that selector as darkSelector, and every thread switches to the dark theme while it matches <html>, and back to light when it stops.

tsx
<CommentsProvider endpoint="https://cms.example.com/actions/comments/api" darkSelector="html.dark">
    {children}
</CommentsProvider>

The script watches <html>'s attributes, so your toggle needs no extra code. Threads still waiting to load take the right theme too, so each draws in it from the start, and a thread whose theme is none is left alone. A selector that isn't valid CSS logs a warning in the browser console and changes nothing. Any selector that can match <html> works, such as [data-theme="dark"] or :root.theme-dark.

When your app decides the theme some other way, such as from its own state, pass it as theme.

tsx
// Your app's own dark mode state.
const { dark } = useAppearance();

<CommentsThread ownerUri={uri} theme={dark ? 'dark' : 'light'} />

The theme is the thread root's data-comments-theme attribute, which the stylesheet reads to choose its colours, so your own CSS can follow it as well.

css
/* A softer shadow on the editor in the dark theme. */
.comments[data-comments-theme='dark'] .comments__frame {
    box-shadow: 0 1px 2px rgb(0 0 0 / 40%);
}

The dark theme gives the thread a padded panel of its own, coloured by --comments-color-panel, because its light text can't rely on whatever is behind it on your page. auto does the same while the visitor prefers dark. Rich comments' editor follows the thread's theme, and when the theme is auto it takes the visitor's preference as the editor opens.

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