Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tanstack/router/llms.txt
Use this file to discover all available pages before exploring further.
Link API
Components and utilities for type-safe navigation.Link
A strongly-typed anchor component for declarative navigation.
Props
The destination route path. Can be absolute (
/posts) or relative (./edit, ..).Path parameters for the destination route.
Search parameters for the destination route. Can be an object or an updater function.
The hash fragment for the destination URL.
State to pass to the destination route.
The source route path for relative navigation. Defaults to the current route.
Controls route preloading behavior.
false- Don’t preload'intent'- Preload on hover/focus'viewport'- Preload when link enters viewport'render'- Preload on render
Delay in milliseconds before preloading on hover/focus.
Additional props to apply when the link is active.
Additional props to apply when the link is inactive.
Options for determining when the link is active.
If
true, the link will be disabled and not navigate.If
true, the navigation will replace the current history entry instead of pushing a new one.If
true, the scroll position will be reset to the top of the page on navigation.If
true, the navigation will use the View Transitions API if available.Options for masking the URL (showing a different URL in the address bar).
Children
The Link component accepts children as React nodes or a render function:createLink
Creates a typed Link-like component that preserves TanStack Router’s navigation semantics.
Parameters
The host component to render (e.g., a design-system Link/Button).
Returns
A router-aware component with the same API as
Link.useLinkProps
Build anchor-like props for declarative navigation and preloading.
Parameters
Link options (same as Link props).Includes all the same options as
Link: to, params, search, hash, state, preload, activeProps, etc.Optional forwarded ref for the link element.
Returns
React anchor props suitable for
<a> or custom components, including:href- The computed URLonClick- Navigation handleronMouseEnter,onFocus, etc. - Preload handlersdata-status- ‘active’ if the link is activearia-current- ‘page’ if the link is active- Additional props from
activePropsorinactiveProps
linkOptions
Validate and reuse navigation options for Link, navigate or redirect.
Parameters
Literal options object for navigation.
Returns
The same options object, but typed for later spreading into Link, navigate, or redirect.
Navigation Behavior
Active State
Links automatically detect when they match the current route and apply active styling:data-status="active" and aria-current="page" attributes when active.