Skip to content

(autoscroll): add new AutoScroll container widget#2807

Open
ArtemKhvorostianyi wants to merge 3 commits intomainfrom
2389-autoscroll-new-container-widget
Open

(autoscroll): add new AutoScroll container widget#2807
ArtemKhvorostianyi wants to merge 3 commits intomainfrom
2389-autoscroll-new-container-widget

Conversation

@ArtemKhvorostianyi
Copy link
Copy Markdown
Collaborator

Summary

Introduces a standalone AutoScroll widget: a height-constrained, scrollable region that keeps the view pinned to the bottom as children change, with an Enabled flag to turn off follow behavior so users can read earlier content without being pulled down.

Screen.Recording.2026-03-26.at.01.56.08.mov

Implementation

Ivy.AutoScroll (WidgetBase): arbitrary children; Enabled (default true); AutoScrollExtensions.Enabled(...) for fluent configuration; inherits usual Width / Height from WidgetBase.
Frontend (AutoScrollWidget.tsx): maps props to layout; uses useAutoScroll with content: children and enabled.
use-auto-scroll: adds optional enabled; when false, growth/resize no longer forces scroll; when enabled flips back to true, scrolls to bottom once. Existing ChatMessageList behavior unchanged (defaults to enabled).
Registration: "Ivy.AutoScroll" in widgetMap and primitives barrel export.

@ArtemKhvorostianyi ArtemKhvorostianyi linked an issue Mar 26, 2026 that may be closed by this pull request
@artem-ivy-ai
Copy link
Copy Markdown
Collaborator

artem-ivy-ai commented Mar 26, 2026

var autoscrollFollow = UseState(true);

var autoScrollPanel = new AutoScroll(
logLines.Value.Select(line => Text.Muted(line)).ToArray<object>())
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this Cast -> is this needed?

Why can we just directly pass the array?


return Layout.Vertical()
| new AutoScroll(
lines.Value.Select(l => Text.Muted(l)).ToArray<object>())
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment here, why we have to ?


## Enabled follow

When `Enabled` is `true` (default), new content scrolls the view to the bottom. When `false`, the user can scroll manually but the view does not jump when children update — useful when someone is reading older lines while new data arrives.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.Enabled() must be default and be true.
(also this is confusing with .Disabled() API ->
maybe we should just have a ScrollBehavior -> see what enums we already haver in the framework

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

(AutoScroll): new container widget

3 participants