Skip to content

GhostScrollSpy reference ​

Package: @ghostvue/vue. Status: experimental (stability policy).

Headless section-navigation landmark coordinating scroll position, CSS progress variables, and fragment links.

Generated from the component manifest. Edit the manifest or Vue source, then rebuild the docs.

All component references

Props ​

NameTypeDefaultRequiredDescription
asGhostScrollSpyElement"nav"NoDeclared prop `as`.
containerHTMLElement | null | Window—NoDeclared prop `container`.
defaultValuestring—NoDeclared prop `defaultValue`.
endThresholdnumber—NoDeclared prop `endThreshold`.
focusTargetbooleantrueNoDeclared prop `focusTarget`.
historyMode'none' | 'push' | 'replace'"replace"NoDeclared prop `historyMode`.
labelstring"Page sections"NoDeclared prop `label`.
modelValuestring—NoDeclared prop `modelValue`.
orientationGhostScrollSpyOrientation"vertical"NoDeclared prop `orientation`.
probeOffsetnumber—NoDeclared prop `probeOffset`.
scrollBehaviorScrollBehavior"smooth"NoDeclared prop `scrollBehavior`.
travelSettleMsnumber180NoDeclared prop `travelSettleMs`.

Emits ​

NamePayloadDescription
activate{ id: string; element: HTMLElement | null; event: MouseEvent | KeyboardEvent; }Emitted as `activate`.

Models ​

PropEventTypeDescription
modelValueupdate:modelValuestringv-model binding for `modelValue`.

Slots ​

NameDescription
defaultPrimary content.

Slot props: default ​

NameTypeDescription
activeIdstring | undefinedSlot prop `activeId`.
itemCountnumberSlot prop `itemCount`.
scrollTo(targetId: string, options?: { behavior?: ScrollBehavior; focus?: boolean; }) => voidSlot prop `scrollTo`.
travelDirectionGhostScrollSpyTravelDirection | undefinedSlot prop `travelDirection`.

Exposed members ​

NameTypeDescription
activeIdstringExposed property `activeId`.
elementHTMLElement | nullExposed property `element`.
measure() => voidExposed method `measure`.
scrollTo(targetId: string, options?: { behavior?: ScrollBehavior; focus?: boolean; }) => voidExposed method `scrollTo`.

Parts and data attributes ​

AttributeValueDescription
data-partrootNavigation landmark hosting scroll measurement and CSS custom properties.
data-statetravelPresent as data-travel="up" | "down" while the scroll container is moving.

CSS variables ​

NameDescription
--ghost-scroll-spy-progressOverall normalized scroll progress (0..1).
--ghost-scroll-spy-section-progressInterpolated marker position between registered sections (0..1).

Accessibility ​

Role: navigation. APG pattern: https://www.w3.org/WAI/ARIA/apg/patterns/landmarks/.

Required ARIA attributes: aria-label.

Keyboard ​

KeyActionAutomated browser test
TabMoves focus between enabled section links.GhostScrollSpy › tracks aria-current while scrolling and supports keyboard activation (@ghostvue/vue)
EnterActivates the focused section link (scroll, hash update, optional focus transfer).GhostScrollSpy › tracks aria-current while scrolling and supports keyboard activation (@ghostvue/vue)

Verification ​

Each category is reviewed separately. Automated keyboard and axe results do not attest manual or assistive-technology review.

CategoryStatusEvidence
Automated keyboardPassedEvery declared key maps to a Chromium browser test that CI runs and requires to pass on every commit.
Manual interactionNot reviewedNo review recorded.
Assistive technologyNot reviewedNo review recorded.

Examples ​

scroll-spy/basic ​

Example source

Headless list markup Headless

Headless section navigation with CSS progress variables.

Introduction

Intro paragraph 1 with enough copy to scroll this demo page.

Intro paragraph 2 with enough copy to scroll this demo page.

Intro paragraph 3 with enough copy to scroll this demo page.

Intro paragraph 4 with enough copy to scroll this demo page.

Intro paragraph 5 with enough copy to scroll this demo page.

Intro paragraph 6 with enough copy to scroll this demo page.

Details

Details paragraph 1 describing implementation notes.

Details paragraph 2 describing implementation notes.

Details paragraph 3 describing implementation notes.

Details paragraph 4 describing implementation notes.

Details paragraph 5 describing implementation notes.

Details paragraph 6 describing implementation notes.

Details paragraph 7 describing implementation notes.

Details paragraph 8 describing implementation notes.

Summary

Summary paragraph 1 wrapping up the scroll-spy walkthrough.

Summary paragraph 2 wrapping up the scroll-spy walkthrough.

Summary paragraph 3 wrapping up the scroll-spy walkthrough.

Summary paragraph 4 wrapping up the scroll-spy walkthrough.

scroll-spy/themed ​

Example source

Themed article rail

Themed section rail that tracks a short article scrolling in its own panel.

Roll out a feature flag

Plan the rollout

Write down who gets the feature first, which metric proves it works, and the number that would make you roll back.

Agree on an owner for each stage so nobody waits for a sign-off that was never assigned.

Ship behind a flag

Merge the code with the flag off. The release goes out like any other deploy, and nothing changes for customers yet.

Turn the flag on for your own team first and use the feature for a day.

Ramp up traffic

Raise exposure in steps: 1%, 10%, 50%, then everyone. Hold each step long enough to see a full day of traffic.

Pause the ramp, rather than pushing through, when a step looks worse than the one before it.

Watch the metrics

Compare error rates and latency between the flagged and unflagged groups, not against last week.

If the rollback number from your plan is crossed, turn the flag off first and investigate second.

Clean up the flag

Once everyone has had the feature for a full release cycle, delete the flag and the old code path in one change.

scroll-spy/composable ​

Example source

Composable layout Headless

Custom markup powered by useGhostScrollSpy.

custom-a

Section content 1.

Section content 2.

Section content 3.

Section content 4.

Section content 5.

Section content 6.

Section content 7.

Section content 8.

custom-b

Section content 1.

Section content 2.

Section content 3.

Section content 4.

Section content 5.

Section content 6.

Section content 7.

Section content 8.