Skip to content

[Feature Request] Built-in Auto-Scroll to Bottom Support #1093

@phuctm97

Description

@phuctm97

Summary

Add built-in support for "auto-scroll to bottom" behavior, commonly needed for chat interfaces, logs, and similar use cases.

Problem

Currently, implementing auto-scroll to bottom with dynamic item heights is unreliable:

  1. scrollToIndex(lastIndex, { align: "end" }) often falls short with dynamic heights (v3.13.8 doesn't scroll all the way to the bottom correctly #1001)
  2. No way to know when measurements are complete to safely scroll
  3. "Sticky bottom" behavior (stay at bottom unless user scrolls up) requires significant custom logic

Use Case

Chat applications, terminal/log viewers, and any interface where:

  • Items are dynamically sized
  • New items are appended at the end
  • User expects to see the latest item automatically
  • User can scroll up without being forced back down

Proposed API

const virtualizer = useVirtualizer({
  count,
  getScrollElement: () => parentRef.current,
  estimateSize: () => 50,
  // New option:
  stickToBottom: true,
})

// New methods/properties
virtualizer.scrollToBottom()
virtualizer.isAtBottom

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions