Composite · Collections Stable

Comment card

What did someone say about this, and how do I answer or add my own?

3 variants × 2 states · 2 toggles
Red Fox 5m ago

This paragraph says twice what the heading already says. Cut the first sentence (sample).

2 replies

Red Fox 5m ago

This paragraph says twice what the heading already says. Cut the first sentence (sample).

2 replies

Writer
Red Fox, 5m ago (sample)
Comment
This paragraph says twice what the heading already says. Cut the first sentence. (sample)
Reply
Otter, just now: Agreed, and the second sentence can go too. (sample)
You
Otter, no name yet (sample)
Reactions
👍 2, and the quick row 👍 ❤️ 😂 🎉 🤔 (sample)

Point at a card at rest: React, Resolve and More fade in at its top right and nothing moves. The open card lifts with a hard shadow, shows its reply indented beneath the comment and ends with the reply box; turn off With replies to see a thread with none. Turn on With reactions to see a given reaction and the quick row under the open comment. In composing, Comment stays grey until there are words, as the hover cell shows once some are typed.

Built from

Own parts

ds-comment-card__actionsds-comment-card__boxds-comment-card__buttonsds-comment-card__countds-comment-card__headds-comment-card__nameds-comment-card__quickds-comment-card__reactionsds-comment-card__repliesds-comment-card__replyds-comment-card__textds-comment-card__timeds-comment-card__you

Used in composites

Used on screens

Collect feedback from several reviewers

Hand the comments to an agent
See every reviewer's comments on the pageopen

Come back to a page later

Find a thread whose words were cutopen
Reopen the page with its comments

Comment on any page in Safari

Write the first commentcomposing

Go through every comment

See every comment in one placeopen
Bring resolved threads back

Manage a thread

Reply, react, or change your mindopen
Delete a comment, asked once moreopen
Resolve a thread, and bring it back

Review a document

Copy every comment as Markdown
Drop a pin on an exact spotcomposing
Read it back beside the textopen
Comment on a few wordscomposing
Undo a cancelled commentcomposing
Write the commentcomposing

Review a slide deck

See every comment grouped by slideopen
Drop a pin on a slidecomposing

Review on a phone

See every comment full widthopen
Tap a block and typecomposing

Say who you are

Add your name
Prompt to build this component

When to use it

When to use

  • For every thread, everywhere a thread shows: in the column beside the content, beside a bubble, in All comments and in the drawer. The same card is used in all of them.
  • For a comment being written (the composing variant), in the same place the thread will sit once it is sent.

When not to use

  • For a message from Pipeup itself ("Resolved", "Copied"): use cmp-inline-alert beside the comment control.
  • For a list of people: use cmp-list-row.
Variants, anatomy, accessibility, interaction and content rules

Variants

  • default — the compact card at rest: the writer's avatar and name, how long ago, the comment's first lines and its reply count; its actions show on hover. The base class alone, no modifier class.
  • open — the thread opened: the card lifts with a hard shadow, shows its actions, every reply indented beneath the comment, and ends with a reply box with Cancel and Reply beneath it.
  • composing — a new comment: who you are with an invitation to add a name, the box with its placeholder, and Cancel and Comment beneath it; Comment stays grey until there are words.

Anatomy

Built from:

  • cmp-avatar, variant sm — the writer's portrait over their initials, at the start of the head line and of each reply.
  • cmp-icon-button, variant quiet — the actions at the card's top right: React (smiley), Resolve (check) and More (dots-three). The screen wraps More in a cmp-popover-menu (variant icon) holding Copy thread, and on your own comment Edit and Delete; the card itself holds no menu, so the panel that lists cards stays one level deep.
  • cmp-button, variants primary and quiet — Comment or Reply (primary) and Cancel (quiet), beneath the box.
  • cmp-text-field — the comment or reply box, a <textarea> with its visually hidden label.
  • cmp-chip, variant filter — a reaction someone gave, as a pressed pill with the emoji and its count, in the reactions row.

Own parts:

  • Root: <article class="ds-comment-card">; a <button class="ds-comment-card"> is never used: at rest the card's head is the control that opens it.
  • ds-comment-card__head: the first line: avatar, name, time and the actions.
  • ds-comment-card__name: the writer's name; ds-comment-card__time: how long ago, with the exact time in title.
  • ds-comment-card__actions: the icon buttons, hidden until hover, focus or open.
  • ds-comment-card__text: the comment's words, in the open card whole, at rest cut to a few lines.
  • ds-comment-card__count: the reply count at rest ("2 replies").
  • ds-comment-card__replies (with-replies): the replies in the open card, each a ds-comment-card__reply with its own head and text, indented beneath the comment.
  • ds-comment-card__box: the text field and, under it, ds-comment-card__buttons with Cancel and Comment or Reply.
  • ds-comment-card__you: in the composing variant, "You're Otter · add your name" with the name as a quiet button.
  • ds-comment-card__reactions (with-reactions): the row under the comment's words: the reactions given, each a pressed filter chip with the emoji and its count, and, while React is pressed, the quick row of five emoji as quiet buttons (ds-comment-card__quick).

Accessibility

  • At rest the head is a <button> that opens the thread (aria-expanded); the open card is a region named by its writer.
  • Actions are named by their action ("Resolve"), never the glyph; they can be pressed only while they show.
  • The box is a labelled text field: Enter sends, Shift+Enter starts a new line, Esc cancels (with Undo for a few seconds).
  • Opening a thread puts the cursor in its reply box; Esc closes the thread and returns focus to what opened it.

Interaction

  • Hovering the card fades its actions in over --ds-motion-settle on --ds-motion-ease; the card neither moves nor changes size (int-01, int-03).
  • Opening lifts the card by --ds-motion-lift and deepens its shadow over --ds-motion-settle; closing reverses it (int-04).
  • Hovering the card gives the commented content one slow, soft pulse, drawn by the page highlight, not by the card.
  • Comment and Reply are disabled until there are words; the change is a colour change over --ds-motion-quick.
  • React opens the quick row under the comment, fading in over --ds-motion-settle; choosing an emoji adds it to the reactions row (or counts it up) and the quick row fades out. The ⋯ opens the menu the screen wraps it in, as any popover menu does.
  • A sent reply arrives indented beneath the comment with a fade and the short drop over --ds-motion-settle; the reply box empties and keeps focus.
  • Under reduced motion nothing moves; actions appear in place (int-06).
  • A card arrives and leaves with a fade and a short drop over --ds-motion-settle: it carries data-ds-arriving for one frame and data-ds-leaving until it is hidden.

Content rules

  • The time reads "just now", "5m ago", "2h ago", "3d ago"; the exact time is in its tooltip.
  • The quick row offers five emoji: 👍 ❤️😂 🎉 🤔. A reaction reads as the emoji and a count: "👍 2".
  • The More menu reads Copy thread, Edit, Delete, in that order; Delete asks once more before it deletes.
  • The box's placeholder is "Comment or add others with @" or "Reply or add others with @".
  • Until a name is added, the writer is their animal: "Red Fox", "Otter".

Do and don't

  • Do keep the card narrow (about 280 px) so it sits in the column beside the text.
  • Do show a long comment's first few lines at rest, ending with "more".
  • Don't put anything beneath the words that would move them when the actions appear.
  • Don't nest replies: every reply is to the original comment.