<a href> wrapper to enable navigation with client-side routing.
Type Declaration
Props
To
required
Can be a string or a partial Path object:
boolean
Replaces the current entry in the History stack instead of pushing a new one.
any
Adds persistent client side routing state to the next location.The location state is accessed from the
location:boolean
Prevents the scroll position from being reset to the top of the window when the link is clicked and the app is using ScrollRestoration.
RelativeRoutingType
Defines the relative path behavior for the link.
- route (default) - Resolves relative to the route pattern
- path - Resolves relative to the URL path
boolean
Will use document navigation instead of client side routing when the link is clicked.
boolean
Enables a View Transition for this navigation.To apply specific styles for the transition, see
useViewTransitionState.PrefetchBehavior
Defines the data and module prefetching behavior for the link.
- none (default) - No prefetching
- intent - Prefetches when the user hovers or focuses the link
- render - Prefetches when the link renders
- viewport - Prefetches when the link is in the viewport (useful for mobile)
DiscoverBehavior
Defines the link lazy route discovery behavior.
- render (default) - Discover the route when the link renders
- none - Don’t eagerly discover, only discover if the link is clicked
To
Masked path for this navigation. Navigates to one location but displays a different URL in the browser.
Examples
Basic Navigation
With Search Params
Dynamic Links
With State
Replace History
Prefetching
All HTML Attributes
SinceLink renders an <a> element, all standard anchor attributes are supported:
Notes
- Relative links are resolved relative to the route hierarchy by default
- External URLs are detected automatically and render as standard
<a>tags - Supports all standard
<a>HTML attributes - Progressive enhancement: works with JavaScript disabled if using proper forms