Offline Banner

Offline Banner is a copy-paste React component that stops edits made offline never reached the server before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/offline-banner
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsEdits made offline never reached the server

Was this component page useful?

How do I install Offline Banner?

pnpm dlx shadcn@latest add @bollard/offline-banner

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

How do I use Offline Banner in React?

offline-banner-usage.tsx
import { OfflineBanner } from "@/components/ui/offline-banner"

<OfflineBanner online={online} queued={unsynced.length} guardUnload={false} />

What input mistakes does Offline Banner catch?

  • Edits made offline that haven't synced
  • Reconnecting before the queue is flushed: banner stays until it is
  • Sync failure, with Retry
  • Leaving the page with unsynced changes (guardUnload)

What props does Offline Banner accept?

OfflineBanner props
PropTypeDefault
queued

Actions waiting to reach the server (from your outbox or mutation queue).

number0
online

Override detection, e.g. from your own health check. Omit to follow the browser.

boolean—
syncFailed

Syncing the queue failed after reconnecting. Shows a Retry action.

booleanfalse
onRetry

Retry syncing the queue.

() => void—
hideAfter

How long "All changes synced" stays before the banner hides, in ms.

number2500
guardUnload

Warn before closing the tab while offline with queued actions that would be lost.

booleantrue
formatCount

"3 changes". Override to name your items or translate.

(count: number) => stringdefaultCount
offlineText

Message templates; `{count}` is replaced by `formatCount(queued)`.

string"You're offline · {count} will sync when you reconnect"
offlineEmptyText

Shown offline when nothing is queued.

string"You're offline · changes will sync when you reconnect"
syncingText

Shown while queued changes sync.

string"Back online · syncing {count}"
syncedText

Shown once everything has synced.

string"Back online · all changes synced"
failedText

Shown when the sync fails.

string"Couldn't sync {count}"
retryLabel

Retry button text.

string"Retry"

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

How is Offline Banner accessible?

  • Status text uses role=status
  • Hidden banner is inert so it can't take focus
  • Retry is a button; the syncing spinner icon is aria-hidden

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

What are the limitations and server boundaries?

This is a UX guard rail. Enforce on the server: Make queued writes idempotent so replays after reconnecting don't apply twice.

  • Only shows the queue state you pass; it doesn't queue or sync anything itself
  • navigator.onLine can report online on a network with no internet

What expensive mistakes does Offline Banner stop?

Edits made offline never reached the server

Also known as

offline · no internet · network status · sync queue · pwa · reconnecting · retry · connection lost

What dependencies does Offline Banner require?

Offline Banner facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameOffline Banner
Registry identifier@bollard/offline-banner
Install commandnpx shadcn@latest add @bollard/offline-banner
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Offline Banner

What form validation mistake does Offline Banner catch?

Offline Banner prevents edits made offline never reached the server. Counts changes queued while offline and stays up after reconnecting until they have actually synced, so nobody assumes their edits reached the server. Catches: Edits made offline that haven't synced, Reconnecting before the queue is flushed: banner stays until it is, Sync failure, with Retry, Leaving the page with unsynced changes (guardUnload). Limitation: validate offline-banner schemas on backend.

How do I install offline-banner with shadcn?

Run `npx shadcn@latest add @bollard/offline-banner`. Sources added: registry/default/offline-banner/offline-banner.tsx. Package requirements: lucide-react.

What props customize Offline Banner?

Offline Banner accepts `queued`, `online`, `syncFailed`, `onRetry`, `hideAfter`. Configures offline, no internet, network status behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of offline-banner?

Only shows the queue state you pass; it doesn't queue or sync anything itself. navigator.onLine can report online on a network with no internet Server requirement: Make queued writes idempotent so replays after reconnecting don't apply twice.

How does Offline Banner meet accessibility guidelines?

Status text uses role=status. Hidden banner is inert so it can't take focus. Retry is a button; the syncing spinner icon is aria-hidden. Minimizes errors: changes lost when offline, no internet but app said saved.

Which components pair with Offline Banner?