NavigationProgress
Thin bar pinned to the top of the page while a navigation loads. It waits out fast loads, trickles toward 90% on slow ones, and runs to the end when loading stops.
NavigationProgress is the loading bar at the top edge of the viewport that sites like GitHub and YouTube show between pages, in the manner of nprogress and Mantine's NavigationProgress. It takes one boolean, loading, and invents the progress itself, because no router knows how far along a page load is.
import { NavigationProgress } from '@42-central/ui-react/navigation-progress';
<NavigationProgress loading={isNavigating} />Demo
Try each speed. A fast load ends before the delay, so no bar appears. A slow load shows the trickle. In this demo the bar is pinned to the card instead of the viewport.
Code
<NavigationProgress loading={loading} color="neutral" />Colors
color takes any palette color through the kit's data-color system, as Progress does. Use neutral for app chrome.
Code
<NavigationProgress loading={loading} color="blue" />Code
<NavigationProgress loading={loading} color="green" size="sm" />Gradient
variant="gradient" paints a gradient across the whole bar. The default goes from purple to pink. Pass gradient (from / via / to / dir) to set your own stops, using the same shape as Badge and Progress. The gradient spans the full width and the progress reveals it from the left, so the colors stay in place while the bar grows, and the final stop only shows at the end.
Code
<NavigationProgress loading={loading} variant="gradient" />Code
<NavigationProgress
loading={loading}
variant="gradient"
gradient={{ from: 'var(--color-cyan-400)', via: 'var(--color-blue-500)', to: 'var(--color-purple-500)' }}
/>How it moves
- Delay: nothing renders until
loadinghas stayedtruefordelayms (150 by default), so instant navigations don't flash a bar. - Trickle: the bar starts at a sliver. Every 200ms it closes a tenth of the remaining distance to 90%, so it moves quickly at first, then slows, and never finishes on its own.
- Complete: when
loadingturnsfalse, the bar runs to 100%, holds briefly, fades out, then snaps back to 0 with its transition off, so it never slides backwards. - Re-entry: if
loadingturnstrueagain while the bar is still visible, it continues from where it is. If it had already reached 100%, it restarts from the sliver. - Reduced motion: when the user prefers reduced motion, there is no trickle and no reveal animation. The bar sits at full width while loading and fades when done.
With TanStack Router
Mount it once, in the root layout. Don't add it per route.
import { useRouterState } from '@tanstack/react-router';
export function RouteProgress() {
const loading = useRouterState({ select: (s) => s.isLoading });
return <NavigationProgress loading={loading} color="neutral" />;
}Accessibility
The bar is aria-hidden. It repeats information the page change itself gives, and the router or page should announce that change, not the bar. That is why it is not a role="progressbar". For progress that has a real value, use Progress.
Styling
sizesets the thickness. The default isxs(2px).- The bar is
fixedat the top withz-index: var(--navigation-progress-z, 1000). Set that variable to move it under or over your overlays, or passclassName="absolute"to pin it to a positioned parent.
Props
| Prop | Type | Default |
|---|---|---|
loading | boolean | (required) |
delay | number (ms) | 150 |
variant | 'filled' | 'gradient' | 'filled' |
color | Color (ignored for gradient) | kit default solid |
gradient | { from?, via?, to?, dir? } | purple-300 → pink-400, to-r |
size | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xs' |
className / classNames.root / classNames.bar | string | |
testId | string |
Changelog
Circular Progress
Ring progress indicator. Filled and gradient arcs across eleven colors, with a built-in indeterminate spinner — the circular counterpart of Progress.
Alert
The wide, static sibling of Notification — an inline status card for page content (a doc callout, a form-level warning), not a floating toast.