Ir al contenido
Español

Cómo funciona

All four glyphs live in one slot and cross-fade with a slight spring, so the indicator never shifts. Text changes slide vertically inside a box whose width is measured and eased, and the tone colour mixes the surface, border and icon from one value.

Úsalo para

  • Editors and forms that save automatically.
  • Apps that keep working offline and sync later.

Busca otra opción cuando

  • Forms with an explicit Save button: show feedback on that button.
  • Errors that block work: use a callout.

Uso

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

export function EditorHeader({ status, savedAt, retry }) {
  // status: 'idle' | 'saving' | 'saved' | 'offline' | 'error'
  return <SaveStatus status={status} savedAt={savedAt} onRetry={retry} />
}

Propiedades

PropiedadTipoPor defectoQué hace
status'idle' | 'saving' | 'saved' | 'offline' | 'error''idle'The current state; saved relaxes into idle after settle ms.
savedAtstring—Appended to the idle label, such as “2 min ago”.
onRetry() => void—Shows a Retry button in the error state.
labelsobject—Replaces idle, saving, saved, offline, error and retry text.
variant'pill' | 'inline''pill'Tinted pill, or plain icon and text.
settlenumber2400Ms before Saved becomes the quiet idle label; 0 keeps it.

Accesibilidad

  • The icon and label sit in a polite role status region, so each new state is announced once; the outgoing label is aria-hidden.
  • Each state has its own icon shape and text, not colour alone.
  • Retry is a real button, 32px high, with a focus ring.
  • With reduced motion labels fade instead of sliding, the width snaps and the arc turns slowly.

Movimiento

Label slides 320ms ease-out (old one 220ms); width 320ms; icons cross-fade with a 320ms spring; check stroke draws in 360ms; arc turns every 900ms.

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.

SaveStatus.jsxsave-status.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.

Avisos
Lluvia de confeti viene con Pro. La vista previa aparece al desbloquearlo.