组件 · 消息
ConversationPanel
The main-area panel for one conversation — a panel header, an optional row of tabs, the message list and the composer.
也叫 Channel panel
import { ConversationPanel } from "@botiverse/raft-ui";ConversationPanel lays out one conversation in the desktop main area: a channel or a direct message. It is a Panel with a PanelHeader, an optional row of tabs under it, the message list and the composer.
When to use
| Situation | Use |
|---|---|
| A channel or a direct message in the main area | ConversationPanel |
| The replies to one message, beside the conversation | ThreadPanel |
| Tasks, files or a profile beside the conversation | A Panel with edge="attached" |
| Any other column of the main area | Panel |
Anatomy
ConversationPanelRoot: the panel. It is aPanelwithedge="inset"by default.- A
PanelHeader: the conversation's location tile or avatar, its name, its description and its actions. Its parts and rules are in Panel. ConversationPanelContent: everything under the header.ConversationPanelTabs: an optional row of Tabs, with aline-seamunder it.ConversationPanelBody: the scroll boundary for the message list.ConversationPanelFooter: the composer (Composer). It adds no space above the composer: the list ends withpb-timeline-endunder its last row, so the composer's frame sits a section step, 24px, under the last line (Timeline rhythm).
ConversationPanelEmptyState, withConversationPanelEmptyStateBrandandConversationPanelEmptyStateBrandMark: the panel's content when no conversation is open.
Variants
A place can hold several kinds of content, such as a channel's chat, tasks and files. They are one row of sticker tabs in ConversationPanelTabs, under the header (Navigation). Leave the row out when the place has only one view, such as a thread.
Behavior
- The header, the tabs and the composer stay in place; the message list is the only part that scrolls.
- The row of tabs scrolls sideways on its own when the tabs don't fit (Tabs).
- On a phone, the conversation is a pushed page: its header is the top bar, with Back (Responsive layout).
Accessibility
ConversationPanelRootrenders asection. Name it after the conversation witharia-labeloraria-labelledby.- Name the row of tabs after the conversation as well (
aria-label="launch-week"on theTabsList). - The header's buttons and the composer's field need their own names; see Panel and Composer.
Rules
- Put the row of tabs directly under the header, outside the scrolling message list.
- Start the first tab on the header's edge: 20px on desktop and 16px on a phone, the same margin as the header's first element and the message avatar column (Page structure).
ConversationPanelTabssets this margin.
API
ConversationPanelBody, ConversationPanelContent, ConversationPanelEmptyState, ConversationPanelEmptyStateBrand, ConversationPanelEmptyStateBrandMark, ConversationPanelFooter
| 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.
ConversationPanelRoot
| Prop | 类型 | 默认值 |
|---|---|---|
| PanelEdge | "inset" | |
| 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.
ConversationPanelTabs
| 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.