组件 · 消息
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.
When to use
| Situation | Use |
|---|---|
| A message has replies in a thread | MessageReplies, under the message's body |
| A link to a thread inside running text | A reference chip (MessageItem) |
| The thread itself | ThreadPanel: beside the conversation on desktop, covering it with Back on a phone (Conversation) |
Anatomy
MessageReplies: the block. Abuttonby 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 asstrong, 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
| State | Look |
|---|---|
| No new replies | The summary in foreground-muted |
| New replies | The summary in ink, with the count of new replies as a pink sticker |
| A draft in the thread | A Draft item in the summary |
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
MessageRepliesis onebuttonor link; nothing inside it is focusable.- Give it an
aria-labelthat 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
MessageRepliesItemTimewithdateTime.
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 | 类型 | 默认值 |
|---|---|---|
| Allows 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 · Changed
MessageRepliesstays 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 withvp test --browser.enabled.