Skip to content

MagicScrollOptions

Defaults for an application or overrides for one magicScroll region.

optional activationThreshold?: number

Relative activation threshold (0.0 to 1.0) defining the trigger line within the visible reading area.


optional anchorPrefixes?: readonly string[] | string[]

Allowed anchor ID prefixes. Descendant elements matching any prefix participate. Explicit scrollAnchor markers also participate. Passing an empty array [] disables prefix matching so only explicit markers participate.


optional anchorSelection?: AnchorSelectionMode

Selection strategy for anchor discovery.

  • 'all': Selects elements matching prefixes or explicit markers (default).
  • 'explicit': Selects only elements with explicit scrollAnchor markers.

optional behavior?: object

Restoration and deliberate user navigation have separate defaults.

optional interaction?: ScrollBehavior

optional restoration?: ScrollBehavior


optional bottomOffset?: number

Bottom offset in pixels to adjust the active reading boundary from the bottom.


optional debounceTime?: number


optional headerOffset?: number

Gap below the header, or the complete top offset when no header is selected.


optional headerSelector?: string

Selector for a fixed/sticky header whose height is measured automatically.


optional ignoreWhenInView?: "none" | "top" | "full" | "always"


optional preserveOnLayoutChange?: boolean

Preserve anchor-relative reading position when region content reflows (e.g. image loads, form expansions, accordion toggles) without changing scrollSource. Defaults to false (explicit opt-in).


optional preserveOnResize?: boolean

Preserve the current anchor on window resize and measured header-height changes.


optional restoreOnDataChange?: boolean

Keep the current anchor visible after later data updates. Defaults to true.