AI Chat Fancy Stable

ScrollAnchor

A scroll region that stays pinned to its last line while content streams in, lets go when the reader scrolls up, and floats a pill offering the way back down

Preview

Installation

pnpm add fancy-ui-svelte
import { ScrollAnchor } from 'fancy-ui-svelte'

Usage

svelte
<script lang="ts">
  import { ScrollAnchor } from 'fancy-ui-svelte';
</script>

<ScrollAnchor />

Examples

Basic Usage

Props

PropTypeDefaultDescription
active booleantrueWhether the region pins itself to the bottom as content arrives — bind it to your streaming flag. False leaves an ordinary scroll box, and hides the return button with it
bottomThreshold number40How close to the bottom (px) still counts as pinned
returnLabel string"Jump to latest"Label on the floating return button, and its accessible name
showReturn booleantrueWhether the floating return button appears once the reader scrolls away from the bottom
maxHeight string"100%"Height cap on the scrolling region — any CSS length
onStickChange (stuck: boolean) => void-Called when the region pins itself or lets go, never on every scroll

Slots

SlotDescription
childrenThe scrolling content