Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Connection Fallback Error Block for React

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.

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 their live connection dropped and what the app is doing instead, with this connection lost error for React with Base UI. It's a whole screen, centred, with the page's rails and one band across it. Three drawn signal bars stand over the headline, one lit and pulsing three times on load, then the Shine Button Reconnect now, the only colored control, and a Button that keeps polling. Under them three rows say where each way of staying in touch stands, each with a shape and a word: WebSocket lost, server-sent events blocked by a proxy and polling every 15 seconds active. Reconnect now is a short scripted attempt of 800 ms: the first press is refused, the second restores the WebSocket, in the demo only, all three bars light up, the headline says the connection is back and the second button becomes Break it again. Keep using polling pins the fallback, and Reconnect then says it won't try. A line under the rows says when it last connected and how many edits are waiting on this device. The band's rules come from Guides, and the entrance is CSS only. For a collaborative editor, a chat or any app that holds a live link.

FAQ

Does Reconnect now open a connection?

No. It runs a script: Trying WebSocket for 800 ms, then "Still blocked" on the first press and "WebSocket restored, in this demo" on the second, so a viewer can see both outcomes and neither is an accident. To wire it, open your real socket where the code says so, keep the busy state until it connects or fails, and show the failure's reason; keep the three rows, which are computed from the stage and the toggle.

Why does the page show three ways of connecting?

Because that is what a real client does. It tries a WebSocket, falls back to server-sent events when a proxy or firewall blocks it, and then to polling on a timer, which almost always works. Showing the ladder tells people their edits are still safe and updating, only slower. The rows are typed in ROWS, and their words come from one helper, so adding a fourth is one entry and one case.

How can you tell the rows apart without color?

By shape and word: a solid square for connected or active, a cross for lost, a circle with a slash for blocked and a dashed circle for standby or trying, with heavier type for the worse states. The signal bars say the same in heights: one lit while the app polls, all three when the WebSocket is back. The pulse runs three times on load and stops, and not at all with reduced motion.

Is it usable with a keyboard and a screen reader?

Tab reaches Reconnect now and the second button, which keeps its width as its label changes (Keep using polling, Polling is kept, Break it again) and reports its pressed state. The result line under them is a polite status message, and when an attempt ends, focus moves to it, because the busy button drops focus.

Are the edits really saved on the device?

The page says so about a typed count; it keeps nothing. In your app, say it only if your client queues edits locally (an outbox in IndexedDB, for example) and flushes them when the connection returns, and show the real count.

What changes on a phone?

The bars, the headline and the buttons come first; the buttons wrap onto two lines if they must, and each transport row stacks its name over its state. Nothing scrolls sideways down to 320 px.

  • Pro

    A full-screen page for a database that refuses connections: Retry now and a switch that retries by itself on a press-started countdown, four pool cells and the backoff schedule drawn to scale.

  • Pro

    A full-screen page for an address that can't be found: an editable address, a Run the check button, and the lookup drawn as five hops that walk one at a time and stop at the one with no answer.

  • Pro

    API Uptime Strips Error

    Server and outages

    A full-screen outage page for an API host: the display 503, a notify-me form that saves in the page, and four APIs as rows of thirty day-cells with a shape and a word for today and an uptime counted from the minutes.

  • Pro

    Services Status Error

    Server and outages

    A hosting platform's status as one framed panel: six services with a shape and a word for each state, a summary counted from them, an Affected only filter that holds the panel's height, and a Refresh status button.

  • Pro

    A full-screen page for one failing service in a marketplace: a framed map of five services joined by hairlines, a radio group that opens each service's panel, and a list of what still works counted from the dependencies.

  • Pro

    A full-screen warning for a site whose certificate expired: a drawn open padlock, Back to safety, and an Advanced disclosure with the certificate chain, the error code to copy and an unsafe route behind a checkbox.