Raft 设计系统

组件 · 消息

MessageReplies

The thread under a message — a gray block with the reply count, a pink count of new replies and up to 3 previews — that opens the thread as one control.

稳定也叫 Thread replies
import { MessageReplies } from "@botiverse/raft-ui";
本页尚未翻译
译文完成之前,这里显示英文原文。 阅读英文版

The thread summary under a message: a soft gray block that says how many replies there are, shows a pink count when some are new, and previews the latest replies. The whole block is one control that opens the thread.

message-replies/compositions/default

When to use

SituationUse
A message has replies in a threadMessageReplies, under the message's body
A link to a thread inside running textA reference chip (MessageItem)
The thread itselfThreadPanel: beside the conversation on desktop, covering it with Back on a phone (Conversation)

Anatomy

  • MessageReplies: the block. A button by default; render a link when the thread has a URL. Required.
  • MessageRepliesSummary: the first line. Required.
    • MessageRepliesSummaryItem: one fact in it: "4 replies", "1 new", "Draft". Rendered as strong, it becomes the pink count of new replies.
  • MessageRepliesItem: one reply preview, up to 3:
    • a small Avatar;
    • MessageRepliesItemSender: the name;
    • MessageRepliesItemContent: the start of the reply;
    • MessageRepliesItemTime: when it was sent, in Space Mono.

States

StateLook
No new repliesThe summary in foreground-muted
New repliesThe summary in ink, with the count of new replies as a pink sticker
A draft in the threadA Draft item in the summary
message-replies/compositions/single-unread
message-replies/compositions/unread-draft

Behavior

  • Selecting anywhere on the block opens the thread. The block is read, so it hovers with the subtle tier and presses with the medium tier (Hover and press).
  • The block lines up with the message text and is at most 480px wide.
  • Each preview keeps to one line: the content truncates, the name and the time stay.

Content

  • Write the count as "1 reply" or "4 replies", and the new count as "1 new".
  • Separate the summary items with a middle dot.
  • Show the latest replies, at most 3 (Conversation).

Accessibility

  • MessageReplies is one button or link; nothing inside it is focusable.
  • Give it an aria-label that says which thread it opens, such as "Open the #launch-week checklist thread": its content is long and would otherwise be read in full.
  • Hide the separators and the trailing chevron from assistive technology (aria-hidden).
  • Render each MessageRepliesItemTime with dateTime.

Rules

  • Put the block on fill-muted, without a border: it is part of the message, not a card.
  • Show new replies as a pink count with ink type, like every unread count (States). Don't use another color for thread replies.

API

MessageReplies, MessageRepliesItem, MessageRepliesItemContent, MessageRepliesItemSender, MessageRepliesItemTime, MessageRepliesSummary, MessageRepliesSummaryItem

Prop类型默认值
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

改动

  • 0.5.36 · ChangedMessageReplies stays on the message text line: the dead right margin is gone (a 100%-wide block drops an over-constrained -mr-2) and a browser spec now pins the rendered right edge, so a class-only assertion can no longer regress it silently. Run it with vp test --browser.enabled.