Skip to content
v0.9.1
Components

Comments

Threads for tasks, documents, deals and posts: replies, likes, @mentions and a box that grows as you write. Add data-momo-comments to a section.comments and tell it who is writing with data-me.

Thread

Click Reply under any comment, write, and press Ctrl + Enter (⌘ + Enter on a Mac). Type @ to mention someone from the list. Threads with two or more replies get a Hide replies button.

Comments 3

  1. Sallie WadeOwner

    The new pricing page is up on staging. @Lucy Fox can you check the plan table on phones?

    1. Lucy Fox

      Checked on two phones. The yearly toggle wraps under the price, otherwise good.

    2. Sallie Wade(edited)

      Fixed, thanks! @Henry Richardson ready for your review.

<section class="comments" data-momo-comments data-me="Henry Richardson" data-me-initials="HR" data-me-color="violet" data-people="cm-people" aria-labelledby="cm-title">
  <div class="comments-head">
    <h3 class="comments-title" id="cm-title">Comments <span class="badge badge-pill" data-momo-comments-count>3</span></h3>
  </div>
  <ol class="comment-list">
    <li class="comment" id="cm-1">
      <span class="avatar bg-cyan" aria-hidden="true">SW</span>
      <article class="comment-main">
        <header class="comment-head"><b class="comment-author">Sallie Wade</b><span class="badge badge-sm">Owner</span><time class="comment-time" datetime="2026-11-29T09:12">2 h ago</time></header>
        <div class="comment-body"><p>The new pricing page is up on staging. <span class="mention">@Lucy Fox</span> can you check the plan table on phones?</p></div>
        <div class="comment-actions">
          <button class="comment-action" type="button" data-momo-like aria-pressed="false"><i class="mi mi-thumbs-up" aria-hidden="true"></i><span class="comment-count">2</span><span class="visually-hidden">Like</span></button>
          <button class="comment-action" type="button" data-momo-reply><i class="mi mi-reply" aria-hidden="true"></i>Reply</button>
        </div>
        <ol class="comment-replies">
          <li class="comment" id="cm-2">
            <span class="avatar bg-orange" aria-hidden="true">LF</span>
            <article class="comment-main">
              <header class="comment-head"><b class="comment-author">Lucy Fox</b><time class="comment-time" datetime="2026-11-29T10:02">1 h ago</time></header>
              <div class="comment-body"><p>Checked on two phones. The yearly toggle wraps under the price, otherwise good.</p></div>
              <div class="comment-actions">
                <button class="comment-action" type="button" data-momo-like aria-pressed="true"><i class="mi mi-thumbs-up-filled" aria-hidden="true"></i><span class="comment-count">1</span><span class="visually-hidden">Like</span></button>
                <button class="comment-action" type="button" data-momo-reply><i class="mi mi-reply" aria-hidden="true"></i>Reply</button>
              </div>
            </article>
          </li>
          <li class="comment" id="cm-3">
            <span class="avatar bg-cyan" aria-hidden="true">SW</span>
            <article class="comment-main">
              <header class="comment-head"><b class="comment-author">Sallie Wade</b><time class="comment-time" datetime="2026-11-29T10:20">45 min ago</time><span class="comment-edited">(edited)</span></header>
              <div class="comment-body"><p>Fixed, thanks! <span class="mention mention-me">@Henry Richardson</span> ready for your review.</p></div>
              <div class="comment-actions">
                <button class="comment-action" type="button" data-momo-like aria-pressed="false"><i class="mi mi-thumbs-up" aria-hidden="true"></i><span class="comment-count"></span><span class="visually-hidden">Like</span></button>
                <button class="comment-action" type="button" data-momo-reply><i class="mi mi-reply" aria-hidden="true"></i>Reply</button>
              </div>
            </article>
          </li>
        </ol>
      </article>
    </li>
  </ol>
  <form class="comment-form"></form>
  <datalist id="cm-people">
    <option value="Sallie Wade" label="Design lead" data-initials="SW" data-color="cyan"></option>
    <option value="Lucy Fox" label="Frontend" data-initials="LF" data-color="orange"></option>
    <option value="Eula Horton" label="Product" data-initials="EH" data-color="pink"></option>
    <option value="Ina Hogan" label="Support" data-initials="IH" data-color="yellow"></option>
    <option value="Henry Richardson" label="You" data-initials="HR" data-color="violet"></option>
  </datalist>
</section>

An empty <form class="comment-form"> is filled in for you (your avatar, the box, the buttons). Write your own form instead to change the text or add buttons: keep a textarea.comment-input in it.

Parts

ClassIs
.commentOne comment (li): an avatar and a .comment-main
.comment-head.comment-author, any badge, time.comment-time (can be a link to the comment), .comment-edited
.comment-bodyThe text. .mention marks a name, .mention-me marks you.
.comment-actions.comment-action buttons: data-momo-like (with a .comment-count), data-momo-reply, or your own
.comment-repliesThe thread under a comment. Replies to replies stay in the same thread and start with an @mention.
[data-momo-comments-count]Shows how many comments there are, kept up to date

Boxed and states

.comments-cards puts each comment in a bordered card, for a feed or a sidebar. .is-resolved grays a settled comment, .is-highlight (or opening a link to the comment's id) marks one in yellow, .is-pending fades one while it is being saved.

  1. Eula HortonResolved

    Can we say "per seat" instead of "per user"?

  2. Ina Hogan

    Three customers asked about the annual discount today.

    Is the 20% off still on for teams?
<section class="comments comments-cards" data-momo-comments data-me="Henry Richardson" data-me-initials="HR" data-me-color="violet" aria-label="Review notes">
  <ol class="comment-list">
    <li class="comment is-resolved">
      <span class="avatar bg-pink" aria-hidden="true">EH</span>
      <article class="comment-main">
        <header class="comment-head"><b class="comment-author">Eula Horton</b><time class="comment-time">Yesterday</time><span class="comment-resolved"><i class="mi mi-circle-check" aria-hidden="true"></i>Resolved</span></header>
        <div class="comment-body"><p>Can we say "per seat" instead of "per user"?</p></div>
      </article>
    </li>
    <li class="comment is-highlight">
      <span class="avatar bg-yellow" aria-hidden="true">IH</span>
      <article class="comment-main">
        <header class="comment-head"><b class="comment-author">Ina Hogan</b><time class="comment-time">10 min ago</time></header>
        <div class="comment-body"><p>Three customers asked about the annual discount today.</p><blockquote>Is the 20% off still on for teams?</blockquote></div>
        <div class="comment-actions">
          <button class="comment-action" type="button" data-momo-like aria-pressed="false"><i class="mi mi-thumbs-up" aria-hidden="true"></i><span class="comment-count">4</span><span class="visually-hidden">Like</span></button>
          <button class="comment-action" type="button" data-momo-reply><i class="mi mi-reply" aria-hidden="true"></i>Reply</button>
        </div>
      </article>
    </li>
  </ol>
</section>

Saving comments

Before a comment is added, the section fires momo:comment with detail.text and detail.parent (the id of the top comment, or null). Momo adds it right away as "Just now". To save it first, call preventDefault() and add it yourself once your server answers. Likes fire momo:like.

const thread = document.querySelector('.comments');
thread.addEventListener('momo:comment', async (e) => {
  e.preventDefault();
  const saved = await fetch('/api/comments', { method: 'POST', body: JSON.stringify(e.detail) }).then((r) => r.json());
  Momo.comments.add(thread, { id: saved.id, name: 'Henry Richardson', initials: 'HR', color: 'violet', text: saved.text, parent: e.detail.parent });
});

Momo.comments.remove('cm-3');

Text is always added as plain text (never as HTML). Blank lines start a new paragraph and @Name becomes a mention when the name is in the data-people list.

Accessibility

Start

OverviewStart Getting startedStart CustomizeStart

Guides

AccessibilityGuides BreakpointsGuides ChangelogGuides Customize componentsGuides JavaScriptGuides MotionGuides OptimizeGuides PhonesGuides RebootGuides Right-to-left (RTL)Guides Stacking orderGuides Using Momo with AIGuides

Foundations

ColorsFoundations TypographyFoundations ProseFoundations Images & figuresFoundations CodeFoundations Lines & shadowsFoundations Dark modeFoundations

Forms

Checkbox & switchForms ComboboxForms Date pickerForms Date rangeForms Fields & labelsForms File uploadForms Floating labelsForms Number stepperForms PasswordForms PIN codeForms RatingForms SelectForms SliderForms Tag inputForms Time pickerForms ValidationForms

Components

AccordionComponents Alert & bannerComponents AvatarComponents BadgeComponents BreadcrumbComponents ButtonComponents Button groupComponents CalendarComponents CardComponents CarouselComponents ChartsComponents ChipsComponents CollapseComponents Command paletteComponents CommentsComponents Confirm dialogsComponents Cookie bannerComponents Data tableComponents Description listComponents Dialog & toastComponents DividerComponents DrawerComponents Dropdown menuComponents Empty stateComponents File managerComponents Filter & sortComponents Gallery & lightboxComponents Inbox & chatComponents Infinite scrollComponents KanbanComponents Keyboard shortcutsComponents List groupComponents MarqueeComponents Media objectComponents Nav overflowComponents Notification centerComponents PaginationComponents ProgressComponents Pull to refreshComponents SkeletonComponents SortableComponents SpinnerComponents Split viewComponents Stat cardComponents Steps & wizardComponents Swipe actionsComponents TableComponents TabsComponents TimelineComponents TogglerComponents Tooltip & popoverComponents TourComponents Tree viewComponents VideoComponents WhiteboardComponents

Layout

Announcement barLayout App shellLayout Back to topLayout Container & sectionLayout ExamplesLayout FooterLayout HeroLayout JumbotronLayout Mega menuLayout NavbarLayout Site sidebarLayout

Sections

Bento gridSections Blog cardsSections Call to actionSections Contact & newsletterSections FAQSections FeaturesSections Logo cloudSections PricingSections TeamSections TestimonialsSections

Utilities

OverviewUtilities State variantsUtilities Display & flexUtilities Grid & gapUtilities SpacingUtilities SizingUtilities TextUtilities Links & color strengthUtilities Position & overflowUtilities BackgroundsUtilities Borders & effectsUtilities Transforms & filtersUtilities InteractionsUtilities

Helpers

Fixed, sticky & frostedHelpers Hover & focusHelpers Hover revealHelpers Icon linkHelpers PrintHelpers Relative timeHelpers Screen reader textHelpers Scroll inHelpers ScrollspyHelpers Share buttonHelpers Skip linkHelpers StacksHelpers Stretched linkHelpers Theme toggleHelpers Truncated textHelpers

Page patterns

404 pagePage patterns Coming soonPage patterns Login & registerPage patterns SettingsPage patterns ProfilePage patterns CRM contactsPage patterns ProjectsPage patterns File manager pagePage patterns Billing & plansPage patterns Help centerPage patterns Mobile app screensPage patterns
↑ ↓ moveEnter openEsc close