Save Status

Makes autosave honest: an aging "Saved · 2 min ago", a clear offline state and Retry on error, so failures aren't silent.

StopsAutosave failed silently while offline

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/save-status.json

The files land in your project. They're yours to edit.

Usage

save-status-usage.tsx
import { SaveStatus, useAutosave } from "@/components/ui/save-status"

<SaveStatus status={status} savedAt={savedAt} error={error} offlineLabel={OFFLINE} onRetry={() => void retry()} />

What it catches

  • Saves that failed, shown with Retry
  • Being offline, instead of a misleading "Saved"
  • How long ago the last save landed
  • Out-of-order saves (one at a time, newest value goes next)
  • Leaving with unsynced changes (optional beforeunload warning)

Props

SaveStatus props
PropTypeDefault
status* (required)

Current state, usually from `useAutosave`.

AutosaveStatus—
savedAt

When the last successful save finished (ms epoch).

number—
error

Error detail shown after `errorLabel`, e.g. "Server returned 503".

string—
onRetry

Called by the Retry button. The button is hidden without it.

() => void—
idleLabel

Text before anything has changed.

string"No changes yet"
savingLabel

Text while a save is in flight.

string"Saving…"
savedLabel

Text after a save; the age is appended ("Saved · 2 min ago").

string"Saved"
offlineLabel

Offline text. Only claim "on this device" when a `draftKey` really keeps a copy.

string"Offline. Will save when you're back"
errorLabel

Text when the save failed.

string"Not saved"
retryLabel

Retry button text.

string"Retry"

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

Accessibility

  • Status text in a polite live region; errors announced with role=alert
  • Exact save time available in a title tooltip
  • Retry is a real button; icons are aria-hidden

Only what the source does. Test with your own screen reader and content before shipping.

Limitations

This is a UX guard rail. Enforce on the server: Reject stale writes with a version or ETag check so an older save can't overwrite a newer one.

  • The offline draft is kept in localStorage on this device only, if you enable it
  • Concurrent edits from other tabs or users are not merged

What it stops

Autosave failed silently while offline

Also known as

autosave · saved indicator · offline · saving... · google docs · debounce · sync status · retry

Field type

Dependencies

Pairs well with