scrollToBottomAction

Also known as chat-scroll, an action to scroll to bottom of an element when it's scrollHeight or content changes.

Demo

Wed Sep 20 2023
Wed Sep 20 2023
Wed Sep 20 2023
Wed Sep 20 2023
Wed Sep 20 2023
Wed Sep 20 2023
Wed Sep 20 2023
Wed Sep 20 2023
Wed Sep 20 2023
Wed Sep 20 2023

Usage

<script>
import { scrollToBottomAction } from "svelte-legos";

// messages data
let messages = [];
</script>

<div use:scrollToBottomAction>
  {#each messages as message}
    <!-- // message component -->
  {/each}
</div>