Link API
Components and utilities for type-safe navigation.Link
A strongly-typed anchor component for declarative navigation.
Props
string
required
The destination route path. Can be absolute (
/posts) or relative (./edit, ..).object
Path parameters for the destination route.
object | function
Search parameters for the destination route. Can be an object or an updater function.
string | function
The hash fragment for the destination URL.
object | function
State to pass to the destination route.
string
The source route path for relative navigation. Defaults to the current route.
false | 'intent' | 'viewport' | 'render'
Controls route preloading behavior.
false- Don’t preload'intent'- Preload on hover/focus'viewport'- Preload when link enters viewport'render'- Preload on render
number
Delay in milliseconds before preloading on hover/focus.
object | function
Additional props to apply when the link is active.
object | function
Additional props to apply when the link is inactive.
object
Options for determining when the link is active.
boolean
If
true, the link will be disabled and not navigate.boolean
If
true, the navigation will replace the current history entry instead of pushing a new one.boolean
If
true, the scroll position will be reset to the top of the page on navigation.boolean
If
true, the navigation will use the View Transitions API if available.object
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
Component
required
The host component to render (e.g., a design-system Link/Button).
Returns
Component
A router-aware component with the same API as
Link.useLinkProps
Build anchor-like props for declarative navigation and preloading.
Parameters
UseLinkPropsOptions
required
Link options (same as Link props).Includes all the same options as
Link: to, params, search, hash, state, preload, activeProps, etc.React.ForwardedRef<Element>
Optional forwarded ref for the link element.
Returns
React.ComponentPropsWithRef<'a'>
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
LinkOptions
required
Literal options object for navigation.
Returns
LinkOptions
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.