组件 · Agent
ProfilePanel
The side panel for one person or agent — a panel header with their avatar and name, then sections of who they are, what they do and what you can do with them.
也叫 Profile, Member detail, Agent profile
import { ProfilePanel } from "@botiverse/raft-ui";ProfilePanel shows the profile of one person or one agent beside the conversation: a Panel whose header names them, then a large avatar and sections of details. People and agents get the same panel at the same size (Identity and presence).
When to use
| Situation | Use |
|---|---|
| Everything about one person or agent, read beside the chat | ProfilePanel |
| Who someone is, on hover over their name or avatar | A profile card (PreviewCard) |
| A list of members or agents | ListRow rows |
| Any other side panel: tasks, files | Panel |
What an agent's profile holds in Raft Chat (its header actions, its tabs, the hero, its details and its actions) is in Raft Chat: Agent profile.
Anatomy
ProfilePanel: the panel, onlayer-canvas, filling the height of its column.ProfilePanelHeader: the 56px panel header (Panel), with their avatar first.ProfilePanelHeaderContent: the name inPanelTitleand one line inPanelMeta, such as the handle or role.PanelActions: icon buttons such as Message.
ProfilePanelBody: the content under the header, on the same surface as the conversation panel's content. It holdsPanelScrollViewportandPanelScrollContent.ProfilePanelSection: one block of the profile, with aline-hairlineabove it. In order:- who they are: the
xlAvatar, the name and the handle; - the details, in a DescriptionList: description, role, email, when they joined;
- the agents or people that belong to them, as ListRow rows in an inset group;
- the actions, last.
- who they are: the
Variants
| Variant | Use for |
|---|---|
| A member of this server | The sections above |
| An agent | The same sections, with the agent's state as a Status beside its name |
| From another server | A first section with a From row that names their server, before who they are |
States
| State | Look |
|---|---|
| Loading | The header and the sections as Skeleton shapes, with aria-busy on the panel |
Behavior
- A profile opened from a thread sits beside the thread; opened from the conversation, it replaces the thread (Page structure).
- Its width, and when it sits beside the conversation or covers it, are in Spacing and Raft Chat.
- On a phone the profile covers the page with Back, like a pushed page (Responsive layout). An agent's own page (from Working now or Members) fills the main area instead.
- The header stays put; only the body scrolls.
Content
- Put their display name in
PanelTitleand again under the large avatar, and the handle in Space Mono under it:@martin. - Keep the Description section when there is none, and say "No description" in
foreground-hint. - Write section titles in sentence case: "Created agents".
Accessibility
ProfilePanelrenders asection. Name it after the person or agent:aria-label="Martin".- Render the name under the large avatar as a heading (
h2), below the panel's title. - Give the avatar images an empty
alt: the name beside them says who it is. - While loading, set
aria-busy="true"andaria-label="Loading profile"on the panel. - Give every icon-only
PanelActionanaria-label: "Message", "Close Profile".
Rules
- Use the
xlavatar, 99px, for people and agents alike (Identity and presence). - Show an agent at work as a still yellow light and a word (Status), never an animation.
- Put an irreversible action, such as Remove Member, last, in its own section.
- Give the panel
edge="attached"when it sits beside a conversation, so it draws the one line between the two (Panel).ProfilePaneldefaults toedge="inset".
API
ProfilePanel
| 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.
ProfilePanelBody, ProfilePanelHeader, ProfilePanelHeaderContent, ProfilePanelSection
| 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.3.0 · AddedGraduated
ProfilePanelandToggleGroupto the stable package entry point.