组件 · 消息
ThreadPanel
The side panel for one thread — a header that names it, the original message, the replies and a composer, with no tabs.
也叫 Thread
import { ThreadPanel } from "@botiverse/raft-ui";ThreadPanel shows the replies to one message beside the conversation it belongs to. It is not a narrower conversation panel: its header names the thread and where it is, the original message comes first, and it has no tabs.
When to use
| Situation | Use |
|---|---|
| The replies to one message, read beside the conversation | ThreadPanel |
| The conversation itself | ConversationPanel |
| Tasks, files or a profile beside the conversation | A Panel with edge="attached" |
| How a thread is reached from a message | MessageReplies |
Anatomy
ThreadPanelRoot: the panel. It is aPanelwithedge="attached", so it draws its own left seam.ThreadPanelHeader: the 56px header, built onPanelHeaderRoot.ThreadPanelTitle: the title, "Thread", followed byThreadPanelTitleMetafor where the thread is.ThreadPanelActions:PanelActionbuttons. The last one is the × (Navigation).
ThreadPanelContent: everything under the header.ThreadPanelSearch, withThreadPanelSearchTrailingandThreadPanelSearchCount: an optional row for searching within the thread.ThreadPanelOriginalMessage: the message the thread replies to, with a hairline under it. The hairline is a boundary: it sits a section step, 24px, under the message's last line, and the replies start a section step under it (ThreadPanelReplySummary) (Timeline rhythm).ThreadPanelBody: the scrolling replies.ThreadPanelReplySummaryandThreadPanelReplyCounthead the list of replies.ThreadPanelFooter: the composer (Composer), with no space of its own above it, as in ConversationPanel.
Behavior
- A thread and a profile can be open together: a profile opened from the thread sits beside it, and a profile opened from the conversation replaces it (Page structure).
- Its width is in Spacing. When it sits beside the conversation and when it covers it is the product's rule (Raft Chat).
- On a phone the thread is a pushed page: the same panel covers the conversation, with Back instead of the ×, and the tab bar stays hidden, as under the conversation (Responsive layout). On desktop it covers the conversation the same way when there isn't room beside it.
Content
- Title the panel "Thread".
- Say in the header where the thread is and how many replies it has: "#launch-week · 3 replies".
Accessibility
ThreadPanelRootrenders asection. Name it witharia-label="Thread".ThreadPanelTitlerenders anh2.- Give every icon-only action an
aria-label: "Search in Thread", "Close Thread".
Rules
- Don't add tabs to a thread. It holds the original message, the replies and the composer, nothing else.
- Leave 20px above the original message. The hover toolbar rides on a message's top edge (MessageItem); the original message is the first item in the scroll area, so with less room the toolbar is cut off and looks pinned under the header.
- Separate the original message from the replies with a
line-hairline, not a seam: both are content of the same panel.
API
ThreadPanelActions, ThreadPanelBody, ThreadPanelContent, ThreadPanelFooter, ThreadPanelHeader
| 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.
ThreadPanelOriginalMessage
接受其元素的全部属性。
ThreadPanelReplyCount, ThreadPanelReplySummary, ThreadPanelRoot, ThreadPanelSearch, ThreadPanelSearchCount, ThreadPanelSearchTrailing, ThreadPanelTitle, ThreadPanelTitleMeta
| 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.1 · FixedRemoved the duplicate inset outline from Elegant dark
ThreadPanelContenton large screens, leaving the header/content seam with a single visual owner.