Skip to content

You preload a link’s data before the user commits to navigating, so the target route renders without waiting for its loader. Preloading is per-<Link> and deduplicated per href — many links to the same target trigger one preload.

Set the preload builder method on a Link with a PreloadType:

Strategy Behavior
PreloadType::Render Preload as soon as the link renders. This is the default.
PreloadType::Intent Preload on the first mouse move over the link, after a delay.
PreloadType::Viewport Preload when the link enters the viewport.
use navi_router::components::{Link, PreloadType};
use std::time::Duration;
Link::new("/users/42")
.preload(PreloadType::Intent)
.preload_delay(Duration::from_millis(120))
.child("Open user 42")
.build()

Tune how long the pointer must hover before an Intent preload fires with preload_delay.

The Navigator exposes a preload method for the same purpose outside of links:

let navigator = Navigator::new();
navigator.preload("/users/42");