Message Scroller
A Brutalist-styled chat scroll container with automatic end-follow and a raised jump-to-latest control.
Message Scroller pairs Scroll Surface end-follow behavior with Brutalist 2px borders, rounded-base framing, and hard 4px offset shadows. New messages auto-scroll while the reader is at the bottom, pause when scrolling up into history, and snap back via the floating Jump control.
Preview
Section titled “Preview”<div class="h-96 w-full max-w-md">
<proto-ui-brutalist-message-scroller-root id="brutalist-chat">
<proto-ui-brutalist-message-scroller-viewport>
<div class="flex flex-col gap-3 p-4 pb-16">
<div>BF: Deploying to prod real quick.</div>
<div>NK: It's 4:55 PM. On a Friday.</div>
</div>
</proto-ui-brutalist-message-scroller-viewport>
<proto-ui-brutalist-message-scroller-jump>
Scroll to end ↓
</proto-ui-brutalist-message-scroller-jump>
</proto-ui-brutalist-message-scroller-root>
</div>Installation
Section titled “Installation”Available starting in 0.3.0-rc.1 and later releases. Import the prototypes directly from @proto.ui/prototypes-brutalist/message-scroller and adapt them for your target runtime.
import { messageScrollerRoot, messageScrollerViewport, messageScrollerJump,} from '@proto.ui/prototypes-brutalist/message-scroller';Place Root inside a height-constrained container. Root owns the rounded outer frame and 4px shadow, Viewport handles square-cornered vertical scrolling, and Jump floats above the bottom-right corner with a crisp +4px, +4px press snap:
<div className="h-96 w-full max-w-md"> <BrutalistMessageScrollerRoot a11yLabel="Team chat messages"> <BrutalistMessageScrollerViewport> <div className="flex flex-col gap-3 p-4 pb-16"> {messages.map((message) => ( <div key={message.id}>{message.text}</div> ))} </div> </BrutalistMessageScrollerViewport> <BrutalistMessageScrollerJump>Scroll to end ↓</BrutalistMessageScrollerJump> </BrutalistMessageScrollerRoot></div>Anatomy & Behavior
Section titled “Anatomy & Behavior”- Root: Styled
rounded-basepanel with 2px black border and 4px offset shadow; coordinates end-follow state,newContentCount, anda11yLabel. - Viewport: Square-cornered
overflow-y-autoscrollable region that preserves reading position while scrolled away from the end. - Jump: Floating primary raised control that settles into its shadow on press and jumps to the end without stealing keyboard focus.
Examples
Section titled “Examples”Add Messages
Section titled “Add Messages”New messages scroll into view automatically when already at the bottom. Scroll up first and click Add message to preserve your reading position and increment the unread counter.
<div class="h-72 w-full max-w-md">
<proto-ui-brutalist-message-scroller-root id="brutalist-live">
<proto-ui-brutalist-message-scroller-viewport>
<div
id="brutalist-list"
class="flex flex-col gap-3 p-4 pb-16"
></div>
</proto-ui-brutalist-message-scroller-viewport>
<proto-ui-brutalist-message-scroller-jump>
Scroll to end ↓
</proto-ui-brutalist-message-scroller-jump>
</proto-ui-brutalist-message-scroller-root>
</div>
<proto-ui-brutalist-button id="brutalist-add">
Add message
</proto-ui-brutalist-button>Group Feed & Markers
Section titled “Group Feed & Markers”Combine role badges and high-contrast banner markers inside one scrollable transcript.
<div class="h-72 w-full max-w-md">
<proto-ui-brutalist-message-scroller-root id="brutalist-group">
<proto-ui-brutalist-message-scroller-viewport>
<div class="flex flex-col gap-2.5 p-4 pb-16">
<div>BUILD LOG · #release-v3</div>
<div>
Marcus: Jump button settles +4px into its shadow on press.
</div>
</div>
</proto-ui-brutalist-message-scroller-viewport>
<proto-ui-brutalist-message-scroller-jump>
2 new entries ↓
</proto-ui-brutalist-message-scroller-jump>
</proto-ui-brutalist-message-scroller-root>
</div>| Prop | Type | Default |
|---|---|---|
newContentCount | number | 0 |
a11yLabel | string | 'Messages' |
Viewport
Section titled “Viewport”| Expose | Type | Notes |
|---|---|---|
atEnd | ExposeState<boolean> | Whether the viewport is currently at the bottom |
following | ExposeState<ScrollEndFollowState> | Current end-follow state |
requestStatus | ExposeState<ScrollEndFollowRequestStatus> | Status of the latest end-follow request |
jumpToEnd() | () => void | Programmatically scroll to the end |
pauseFollowing() | () => ScrollSurfaceRequestOutcome | Pause automatic end-following |
| Prop / Expose | Type | Default |
|---|---|---|
disabled | boolean | false |
atEnd (expose) | ExposeState<boolean> | Mirrored bottom state from Root |
newContentCount (expose) | ExposeState<number> | Mirrored new-content count from Root |