185 Pro components and page blocks

Get Pro

Updated

Offline Plug

Pro

Preview

Customize

Hide after0.0s
Succeeds
Attempt every4.0s
Spark colour
Light colour

Installation

Pro

Offline Plug is a Pro component

Sign in to see the source, or install it with a license key. The live preview and props above are free to explore.

Install with a key

  1. Add the Pro registry to components.json:
    components.json
    {
      "registries": {
        "@uibrik-pro": {
          "url": "https://uibrik.com/r/pro/{name}.json",
          "headers": { "Authorization": "Bearer ${UIBRIK_LICENSE}" }
        }
      }
    }
  2. Put your key in .env.local and add that file to .gitignore:
    .env.local
    UIBRIK_LICENSE=your-license-key
  3. Install it:
    Terminal
    npx shadcn@latest add @uibrik-pro/offline-plug

Usage

import { OfflinePlug } from "@/components/uibrik/offline-plug/offline-plug";​<OfflinePlug  offlineLabel="Offline"  onlineLabel="Online"  hideAfter={0}  attemptEvery={4}  haptics={false}  sparkColor="#f59e0b"  successColor="#22c55e"  online  position="top"  dim  retry  fixed={false}  onRetry={() => {}}  onChange={(online) => {}}>  …</OfflinePlug>

Where to use Offline Plug

  • Offline-first apps

    Users see the moment the connection drops and the moment it comes back.

    Pairs with Toast

  • Editors and dashboards

    Fading the page while offline explains why live data has stopped moving.

    Pairs with Status Dashboard

  • Mobile web

    Flaky connections on the move get a calm, glanceable state instead of failed requests.

Props

OfflinePlug
offlineLabel
Type string
"Offline"
onlineLabel
Type string
"Online"
hideAfter
Type number
0
How long the pill stays once back online. 0 keeps it there all the time.
attemptEvery
Type number
4
Seconds between the plug's own attempts to get back in. 0 to stop.
haptics
Type boolean
false
Buzz the phone on unplug and plug-in, where supported.
sparkColor
Type string
"#f59e0b"
Spark when the plug pulls out.
successColor
Type string
"#22c55e"
Charging light on the plug, lit while connected.
online
Type boolean
–
Controlled connection state. Leave out to follow the browser's online and offline events.
position
Type "top" | "bottom"
"top"
Where the pill sits over its content.
dim
Type boolean
true
Fade the wrapped content while offline.
retry
Type boolean
true
Let the user push the plug back in, by drag or Enter, to try reconnecting.
onRetry
Type () => boolean | void | Promise<boolean | void>
–
Called when the plug is pushed home. Resolve true if back online; false throws it back out.
fixed
Type boolean
false
Pin the pill to the viewport instead of the wrapper.
onChange
Type (online: boolean) => void
–
Called when the connection drops or returns.
children
Type ReactNode
–
The page or panel the pill floats over.
className
Type string
–
Classes for the wrapper.