Componentfeedback0.49 KB gzipZero dependencies
Connection Status
Connection badge with pinging dot and optional latency readout.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add connection-statusOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { ConnectionStatus } from "@/components/ui/connection-status"; <ConnectionStatus />Source code
connection-status.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxconnection-status.tsx30 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface ConnectionStatusProps extends React.HTMLAttributes<HTMLSpanElement> { latencyMs?: number; /** Connection state; simulated or detects navigator.onLine */ online?: boolean;} /** Network status badge: live ping pulse indicator + latency. */export function ConnectionStatus({ latencyMs, online = true, className, ...props }: ConnectionStatusProps) { const tone = !online ? "text-destructive" : latencyMs === undefined ? "text-success" : latencyMs < 100 ? "text-success" : latencyMs < 300 ? "text-warning" : "text-destructive"; return ( <span className={cn("inline-flex items-center gap-1.5 rounded-full border border-border bg-card px-2 py-0.5 font-mono text-[10px] uppercase tracking-wider", tone, className)}Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { ConnectionStatus } from "@/components/ui/connection-status"; <ConnectionStatus />| Prop | Type | Description |
|---|---|---|
| latencyMs | number | Configures latency ms. |
| online | boolean | Connection state; simulated or detects navigator.onLine |