Skip to content
English

How it works

Progress lives in one registered custom property animated with Web Animations: a quick jump to 10%, then a long ease-out towards 92% that keeps moving more and more slowly. On completion it continues from its current value to 100% in 260ms and fades over 360ms. No timers run per frame, and the bar is clipped rather than moved, so it never sticks out of its container.

Use it for

  • Client-side route changes and other whole-page loads.
  • Inside an app window or panel (position="absolute") when only that area reloads.

Look elsewhere when

  • One button or row is busy: use a spinner there.
  • A long task with real steps: use a progress bar with a value and text.

Usage

import { TopLoader } from './TopLoader.jsx'

// In your app shell: true while a route is loading
export function Shell({ navigating, children }) {
  return (
    <>
      <TopLoader loading={navigating} />
      {children}
    </>
  )
}

Props

PropTypeDefaultWhat it does
loadingboolean—true starts (or keeps) the bar; false completes it and fades it out.
progressnumber—0 to 1. When set, the bar follows this value instead of trickling (for uploads with real progress).
tricklenumber9000Milliseconds the trickle takes to approach 92%; it slows down all the way.
heightnumber3Thickness in px.
position'fixed' | 'absolute''fixed'fixed pins it to the viewport; absolute pins it to the nearest positioned parent (a panel or window).
labelstring'Loading page'Accessible name of the progress bar.
...restHTMLAttributes<HTMLDivElement>—Passed to the root. Colour: --ds-toploader-color (accent); layer: --ds-toploader-z (1000).

Accessibility

  • The bar is role="progressbar" with a label and aria-busy while loading; it is aria-hidden when idle. With progress set it also exposes aria-valuenow.
  • It is decorative motion on top of the page: also mark the content that is changing with aria-busy.
  • Reduced motion: no trickle or sheen; the bar shows full width and breathes in opacity until done.

Motion

Start: 0 to 10% in the first 4% of the trickle on an ease-out, then cubic-bezier(0.05, 0.7, 0.1, 1) towards 92%. Complete: 260ms to 100%, then a 360ms fade after 220ms. A light sheen sweeps the bar every 1.8s.

Add it to your project

Copy the prompt into Codex or Claude Code. The agent reads the published source, shows you what it will write and adds the component next to your own.

TopLoader.jsxtop-loader.csstokens.cssREADME.md

Both files install together. The stylesheet reads the design tokens in tokens.css and carries fallbacks, so it also works alone.

Loading
Image reveal comes with Pro. Its preview shows once you unlock it.
Orbit loader comes with Pro. Its preview shows once you unlock it.