Message Scroller
Keep a conversation readable as messages arrive.
Examples
Keep a conversation readable as messages arrive
React code
import {
MessageScroller,
Message,
MessageContent,
Bubble,
} from "@accelerate/react/components";
export function Example() {
return (
<>
<MessageScroller aria-label="Release conversation">
<Message>
<MessageContent>
<strong>Reviewer</strong>
<Bubble>The checklist is ready.</Bubble>
</MessageContent>
</Message>
<Message data-side="end">
<MessageContent>
<strong>You</strong>
<Bubble>I’ll review it this afternoon.</Bubble>
</MessageContent>
</Message>
</MessageScroller>
</>
);
}Angular code
import { Component } from "@angular/core";
import {
AccMessageScroller,
AccMessage,
AccMessageContent,
AccBubble,
} from "@accelerate/angular/components";
@Component({
selector: "app-example",
imports: [
AccMessageScroller,
AccMessage,
AccMessageContent,
AccBubble,
],
template: `
<div accMessageScroller aria-label="Release conversation">
<article accMessage>
<div accMessageContent>
<strong>Reviewer</strong>
<div accBubble>The checklist is ready.</div>
</div>
</article>
<article accMessage data-side="end">
<div accMessageContent>
<strong>You</strong>
<div accBubble>I’ll review it this afternoon.</div>
</div>
</article>
</div>
`,
})
export class Example {}Installation
Source preview. The expanded component catalog is ahead of the public npm releases. To run these examples in your own application, use packages built from the SDK source used for the previews or a release that includes the APIs below.
- React
@accelerate/ui@0.4.0and@accelerate/react@0.4.0- Angular
@accelerate/ui@0.4.0and@accelerate/angular@0.2.0
Load @accelerate/ui/theme.css and put acc-theme on the app or the region using Accelerator components. See the framework setup guide for the theme and adapter conventions.
Usage
Follows new content while the reader is at the bottom. Scrolling up pauses following and data-at-end reflects the scrolling state.
Import the React component MessageScroller from @accelerate/react/components. For Angular, add AccMessageScroller to the standalone component’s imports and use <div accMessageScroller>.
Examples use these React parts: MessageScroller, Message, MessageContent, Bubble. The Angular examples show the corresponding directives and template hosts.
API reference
- aria-label
- Names the scrollable conversation.
- data-at-end
- Reflects whether the reader is at the bottom. Scrolling up pauses following.