Skip to content

Add easier way to scroll to the bottom of the list #593

@sartak

Description

@sartak

Feature Request

Describe the Feature

I'd like a way to scroll to the bottom of the list.

Describe the Solution You'd Like

Either a scrollToBottom callback, or have the scrollTo callback take an option to go to the bottom.

const { scrollToBottom } = useVirtual({});
scrollToBottom();
scrollToBottom({ smooth: true });
const { scrollTo } = useVirtual({});
scrollTo("bottom");
scrollTo({ offset: "bottom", smooth: true });

Describe Alternatives You've Considered

I currently implement this with scrollToItem({ index: itemCount - 1, align: "end" });, though it required me rearranging some code. This is also what's used in the "stick to bottom" example.

Additional Information

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions