Skip to content

Comment ​

Displays a user comment with avatar, author, timestamp, body content, and an optional action bar. Supports threading via the nested slot.

Basic ​

Tailwind v4
vue
<Comment author="Jane Smith" time="2 hours ago">
  Looks good to me. The crusher throughput numbers are within spec.
</Comment>

With actions ​

Use the actions slot for Reply, Like, Edit, Delete links. Pair with LinkButton variant="ghost" or plain <button> elements.

Tailwind v4
vue
<Comment author="Mike Torres" time="45 minutes ago">
  Downtime on Crusher #2 has been logged.
  <template #actions>
    <Button variant="ghost" size="sm" @click="liked = !liked">Like</Button>
    <Button variant="ghost" size="sm">Reply</Button>
    <Button variant="ghost" size="sm">Edit</Button>
  </template>
</Comment>

With avatar image ​

Tailwind v4
vue
<Comment author="Sarah Chen" time="Yesterday" avatar-src="/avatars/sarah.jpg">
  The sieve test results look within tolerance.
  <template #actions>
    <Button variant="ghost" size="sm">Reply</Button>
  </template>
</Comment>

Highlighted (mention) ​

Use highlighted to draw attention to a comment β€” e.g. when the user was @mentioned.

Tailwind v4
vue
<Comment author="Dan Wright" time="1 hour ago" :highlighted="true">
  <strong>@Jane</strong> β€” can you review the loadout numbers?
</Comment>

Edited ​

Tailwind v4
vue
<Comment author="Jane Smith" time="3 hours ago" :edited="true">
  Updated the throughput figure β€” was using the wrong shift total.
</Comment>

Saving state ​

Tailwind v4
vue
<Comment author="You" :saving="saving">
  {{ commentText }}
</Comment>

Threaded replies ​

Use the nested slot to indent child comments beneath a parent.

Tailwind v4
vue
<Comment author="Jane Smith" time="3 hours ago">
  The overnight numbers look off.
  <template #actions>
    <Button variant="ghost" size="sm">Reply (1)</Button>
  </template>
  <template #nested>
    <Comment author="Mike Torres" time="2 hours ago">
      Scheduled maintenance window β€” should be fine.
    </Comment>
  </template>
</Comment>

Multiple comments ​

Tailwind v4
vue
<div class="flex flex-col gap-4">
  <Comment author="Jane Smith" time="4 hours ago">
    Morning shift crusher throughput was 312 t/h.
  </Comment>
  <Comment author="Dan Wright" time="3 hours ago">
    Fuel consumption was 642 L, within range.
  </Comment>
</div>

Props ​

PropTypeDefaultDescription
authorstringβ€”Required. Display name β€” also used for initials avatar
timestringβ€”Timestamp string, e.g. "2 hours ago"
avatarSrcstringβ€”URL for avatar image. If omitted, shows initials
avatarColorstringβ€”Background color for initials avatar. Auto-derived from name if omitted
editedbooleanfalseShow "(edited)" after the timestamp
highlightedbooleanfalseAmber background β€” use for @mention highlights
savingbooleanfalseShow "Saving…" in place of actions
errorbooleanfalseShow "Failed to save. Retry." in place of actions

Slots ​

SlotDescription
defaultComment body content
actionsAction bar β€” Reply, Like, Edit buttons. Hidden if not provided
nestedThreaded child comments, rendered below with a left border indent

Private β€” Jetpack Labs internal use only