TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/cloudflare/vinext/llms.txt
Use this file to discover all available pages before exploring further.
Link component enables client-side navigation without full page reloads. vinext’s implementation provides viewport-based prefetching, locale support, and scroll management.
Import
Basic Usage
API Reference
Props
The path or URL to navigate to.Can be a string:Or an object with pathname and query:
URL displayed in the browser (for dynamic routes).Legacy pattern — use the
href string directly instead:Replace the current history entry instead of pushing a new one.
Enable automatic prefetching when the link enters the viewport.Uses
IntersectionObserver with a 250px margin. Set to false to disable:Scroll to top after navigation (unless navigating to a hash).
Locale for i18n routing.
locale="fr"— prepend/frprefixlocale={false}— use default locale (no prefix)locale={undefined}— use current locale
Called before navigation (Next.js 16+ View Transitions API).Call
event.preventDefault() to handle navigation manually:Standard Anchor Props
All standard<a> attributes are supported:
Prefetching
How It Works
- Viewport detection: When a
<Link>enters the viewport (+ 250px margin), prefetching begins - App Router: Fetches the
.rscpayload and stores in memory cache - Pages Router: Injects a
<link rel="prefetch">tag - Deduplication: Each URL is prefetched only once
Cache TTL
Prefetched entries are valid for 30 seconds. After expiry, the link re-prefetches on next viewport entry.Disabling Prefetch
Hash Links
Hash-only navigation updates the URL without triggering a full navigation:element.scrollIntoView().
External Links
External URLs are passed through to the browser:useLinkStatus Hook
Track the pending state of a parent<Link>:
Router Integration
App Router
Callswindow.__VINEXT_RSC_NAVIGATE__() to fetch and render the new RSC stream.
Pages Router
Dynamically imports the target page module and re-renders the React root.basePath Support
IfbasePath is configured in next.config.js, it’s automatically prepended:
Limitations
Source
View source code → Implementation:/home/daytona/workspace/source/packages/vinext/src/shims/link.tsx