Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Connection Lost Notification Block for React

A whiteboard that keeps working offline: an offline bar docked at the foot with Retry now and its attempt count, the list of edits waiting to send, troubleshooting tips, and Work offline to fold it to a pill.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Tell people the connection dropped without taking the app away, with this connection lost notice for React with Base UI. It's a board in Kitepad, a collaborative whiteboard, drawn in greys inside a hairline frame with a plus mark on each corner: a top bar and a canvas with three sticky notes. Docked at the stage's foot is an offline bar made from the catalog Alert, "You're offline. Your edits are saved on this device", with Retry now and Work offline, and above it the panel the notice exists for: three queued edits (a moved note, a renamed frame, two comments), each with a glyph, what changed and its time. A Collapsible holds three troubleshooting tips. Retry now counts the attempt ("Attempt 4 of 10") and stops at ten; Work offline folds the bar into a pill, "Offline: 3 queued", that brings it back. It's built from Alert, Collapsible, Button and Guides, with CSS motion only. For editors, whiteboards and any app that queues work while it waits for the network.

FAQ

Does it read my network, and what does Retry do?

No. The demo never touches your connection: Retry now only counts, and says so on the page and in the status line ("This demo never reads your network: Retry only counts"). The next try is a fixed sentence, "Next try in about 30 seconds", not a ticking clock. After ten attempts the sentence reads "Automatic retries have stopped" and Retry now says why it waits. In your app, call your reconnect function from Retry now, set attempt from its result and read navigator.onLine or your socket's state for the bar itself.

What is the list of queued edits?

It is the feature: while offline, an app that keeps working has to say which changes have not been sent. EDITS holds three typed edits (an id, a kind that picks the glyph, its text and the UTC time it was made); the panel shows them in the order they will send, and the bar and the pill say how many wait. In your app fill the list from your outbox of unsent operations and clear it as they are acknowledged.

What does Work offline do?

It folds the bar and the panel away and puts a small button at the stage's foot end, "Offline: 3 queued", so the canvas is free to work on and the notice never goes away entirely. Pressing the pill brings the bar back and moves focus to Retry now. The notice isn't timed: it stays until the connection returns, and the pair to this block, notification-reconnected, is what you show then.

How do the tips open?

The Collapsible's trigger is a real button with aria-expanded; closed, the tips are unseen and out of the tab order, and opening grows the panel upward from the bar, which stays where it is. The tips are written to be true anywhere: check the device is online, turn Wi-Fi off and on, keep the tab open so the queue sends.

Is it accessible?

The bar is a plain note, not an alert, so it never interrupts: a single polite status line says what each press did ("Attempt 5 of 10: still offline"). The queue is a list with a heading, the times are time elements, the pill's name says how many edits wait ("Offline, 3 queued. Show the offline bar") and every control is a real button with a visible focus ring. Nothing here depends on colour: the glyphs and the words carry it.

How does it look on a phone?

The stage is taller so the panel and the bar fit with the tips open. The bar's sentence takes the full width and its two buttons drop to a row under it; each queued edit wraps onto a second line instead of being cut.

  • Pro

    Reconnected Notification

    Live and empty states

    A co-editor's back online notice drawn at the top centre of a document: it says what you missed, opens a catch-up list grouped by type with counts, and folds after a ten-second drain that holds on hover and focus.

  • Pro

    A full-screen page for a live connection that dropped and fell back: three signal bars, three transport rows with a shape and a word each, Reconnect now as a short scripted attempt, and a Keep using polling toggle.

  • Pro

    A connection top bar for a collaborative editor, wired to the browser's online and offline events: Connected, then "You're offline" with a Retry now button and a tinted strip, then "Back online" for a few seconds.

  • Pro

    A sync callout for a data warehouse: one run plays on load, a counter rolling up to 1,248 records over a thin progress bar, then "Warehouse synced" with a countdown to the next run.

  • Pro

    Alert Banner Notification

    Incidents and alerts

    An operations console's banner bar over a sketch of its app: four notices queue by urgency and show one at a time, with Previous, Next, a link, Dismiss and Snooze all for an hour.

  • Pro

    A payments dashboard's charge page with a declined card: an error toast that never times out, a Retry that counts the attempts until the third turns it into Contact support, and the request id with a Copy button.