Skip to content

Lost connection alert

A banner that warns visitors when they lose the network and announces when it is back, using browser events, with no request.

  • Tailwind
  • React
  • CSS
  • WordPress
Open in a new tab

Description

In a customer area, a long form or a web app, losing the network without knowing it loses work. This banner listens to the browser’s offline and online events: when the connection drops it shows in orange “You are offline” with what it means, and stays visible until the network is back or the visitor closes it; when it returns it turns green “Connection restored” and disappears on its own after six seconds. It also shows straight away if the page opens offline. The message is announced by a role="status" region, the state reads from the text and the icon (Wi-Fi crossed out or not), not from colour alone, and the close button is named. No network request or dependency, a few lines of script that clean up properly in React. A slight slide-in removed with prefers-reduced-motion, AA contrast in light and dark mode, a 44 px close target. Example: the members’ area of a hiking club.

Code

Loading the code…

The code of this component in

Archive contents

alerte-connexion-perdue-html-tailwind.zip3 files · 5 Ko

  • index.html5 Ko
  • README.md4 Ko
  • LICENSE.md1 Ko

Tags

Updated on December 2, 2026.

Reviews

No reviews yet.

In the same spirit

  • A bell with an unread badge that opens a notification panel: icons by type, read and unread items told apart, and a "Mark all as read" button.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Short notifications that appear at the bottom of the screen after an action, then disappear.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • The four classic interface messages: information, success, warning and error.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Three callouts for technical documentation: note, tip and warning.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component