Ir al contenido
Español

Cómo funciona

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.

Úsalo para

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

Busca otra opción cuando

  • 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.

Uso

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}
    </>
  )
}

Propiedades

PropiedadTipoPor defectoQué hace
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).

Accesibilidad

  • 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.

Movimiento

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.

Añádelo a tu proyecto

Copia la instrucción en Codex o Claude Code. El agente lee el código publicado, te muestra lo que va a escribir y añade el componente junto a los tuyos.

TopLoader.jsxtop-loader.csstokens.cssREADME.md

Los dos archivos se instalan juntos. La hoja de estilos lee las variables de tokens.css y lleva valores de reserva, así que también funciona sola.

Carga
Revelado de imagen viene con Pro. La vista previa aparece al desbloquearlo.
Cargador orbital viene con Pro. La vista previa aparece al desbloquearlo.