Components · Layout
MessageList
The scrolling timeline of a conversation or thread, with the date lines, the notice at its start and the marker for limited history.
Also called Message timeline, Date divider, Timeline view
import { MessageList } from "@botiverse/raft-ui";MessageList is the scroll container of a conversation: it holds the messages, event lines and dates in one column, newest at the bottom (Conversation). It sits in the body of a ConversationPanel or a ThreadPanel and is the only part of the panel that scrolls.
When to use
| Situation | Use |
|---|---|
| The messages of a conversation or a thread | MessageList |
| One message | MessageItem |
| An action that happened: a claim, a hand-off | SystemMessage, inside the list |
| An agent's history of actions, outside a conversation | Timeline |
| Any other region that scrolls | ScrollArea, or the panel's own PanelScrollViewport |
Anatomy
MessageList: the scroll container. Its props andrefgo to the element that scrolls, so the caller can read and set the scroll position;rootClassNamestyles the outer element.MessageListNotice: a centered line in Space Mono at the start of the history, such as "Beginning of messages".tone="faint"(the default) sets it inforeground-hint,tone="muted"inforeground-muted.MessageListHistoryLimited: a small chip with aline-hairlineoutline, in Space Mono, for a history that doesn't go back to the start.MessageListDateDivider: the date between twoline-hairlinerules, intext-mono-metaandforeground-hint, drawn like an event line (SystemMessage).
Behavior
- The list only scrolls up and down. Wide content, such as a long line of code or a row of tabs, scrolls inside its own container and never widens the messages.
- On desktop the list is a ScrollArea: its thin scrollbar shows only while the list scrolls.
- Below 768px it uses the panel's native scrolling, without the drawn scrollbar (Responsive layout).
- Scrolling reaches the end of the list and stops; it doesn't scroll the page behind it.
- raft-ui doesn't load older messages or virtualize a long history. Do both in the product, through the
ref.
Content
- Write the notice in sentence case and say what it is the start of: "Beginning of messages", "Beginning of replies".
Accessibility
- MessageList renders plain elements and adds no role or live region. Name the panel around it after the conversation (ConversationPanel).
- The notice, the date lines and the history marker are text, not controls.
- Put the date in
MessageListDateDividerin a<time>element withdateTime, as for an event line's time (SystemMessage).
Rules
- Leave room above the first message for its hover toolbar (MessageItem). A list that opens with a date line already has it.
- Show one thing above the oldest loaded message: a notice while older messages load, the history marker when the history is cut short, or "Beginning of messages" once the start is reached.
API
MessageList
| Prop | Type | Default |
|---|---|---|
| string | ||
| 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.
MessageListDateDivider, MessageListHistoryLimited
| Prop | Type | Default |
|---|---|---|
| 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.
MessageListNotice
| Prop | Type | Default |
|---|---|---|
| "muted" | "faint" | "faint" | |
| 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.
Related
Changes
- 0.5.53 · Fixed
MessageListno longer lets wide content (aw-maxtab strip, a long code line) stretch every message past a narrow list on a desktop viewport: itsScrollAreaContentresets Base UI's inlinemin-width: fit-contentto 0, so the content keeps the list width and wide children scroll inside their own box.