Layout Fancy Stable

StickyScroll

Two-column scroll narrative with a scrolling item list and a sticky panel that swaps its content to the item centred in view, stacking to a single top-sticky panel over the items on narrow containers

Preview

Installation

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

Usage

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

<StickyScroll />

Examples

Basic Usage

Props

PropTypeDefaultDescription
items *T[]-Required. The items rendered down the scrolling column.
activeIndex number0Bindable. The active item's index. Holds its last value when nothing intersects the centre line.
panelSide "start" | "end""end"Which logical side the panel sits on. Flips physically under dir="rtl".
crossfade booleantrueWhether the panel crossfades between items. Effective value is always false under reduced motion.
panelClass string-Additional CSS classes for the sticky panel wrapper.
panelHidden booleantrueWhether the panel is aria-hidden. Set false when the panel holds content found nowhere else.
onChange (index: number, item: T) => void-Called only when the active index actually changes.
class string-Additional CSS classes for the root
ref HTMLDivElement | nullnullBindable reference to the root element

Slots

SlotDescription
itemRenders one row, given the item, its index, and whether it's the active one: (item, index, active). (Snippet<[T, number, boolean]>)
panelRenders the sticky panel's content for the active item: (item, index). (Snippet<[T, number]>)