Xzero UI
Pro library

Live visitorsPro

A realtime visitors card where the live count rolls digit by digit, new arrivals ping in on a dotted world map, the top pages reorder with bars, and signups and upgrades tick in with country flags.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui-pro/live-visitors
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui-pro/live-visitors

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { LiveVisitors } from "@/components/xzero/live-visitors/live-visitors";

export function RealtimeCard({ count, pages, arrivals, conversions, status }) {
  // Feed it from your realtime source (a websocket, SSE or a 2s poll of your analytics API).
  return (
    <LiveVisitors
      count={count}
      pages={pages}
      visitors={arrivals}
      events={conversions}
      connection={status}
      onPausedChange={paused => (paused ? socket.pause() : socket.resume())}
    />
  );
}

API reference

LiveVisitors

A realtime visitors card: a pulsing live status, a count that rolls digit by digit, a dotted world map where new arrivals ping in and fade, the top pages right now with bars, and a ticker of signups and upgrades with country flags. With no props it plays a simulated stream of a SaaS marketing site.

PropTypeDefaultDescription
countnumber–People on the site right now. Leave it out to play the built-in simulated stream; once set, the card shows only the data you pass.
pagesLivePage[][]Pages with people on them: { path, visitors }. The card sorts them and lists the top few with bars scaled to the busiest page. Rows slide when the order changes.
visitorsLiveVisitorPing[][]Recent arrivals as map dots: { id, lat, lon, kind? }. New ids ping in, removed ids fade out. kind "event" draws a stronger ring. Keep it to the last few seconds of arrivals.
eventsLiveVisitorEvent[][]Recent conversions, newest first: { id, label, city, country, at, lat?, lon?, flag? }. country is an ISO alpha-2 code; US, GB, DE, FR, NL, SE, CH, JP, IN and BR have built-in flags, others take flag or a neutral swatch. With lat and lon the newest event is labelled on the map for 2s.
connection"live" | "connecting" | "reconnecting""live"The stream's state. connecting shows placeholders in the same space; reconnecting keeps the last data and switches the status to a warning dot with the word Reconnecting.
pausedboolean–Controls the pause state. While paused the card holds the last snapshot, whatever you keep passing.
defaultPausedbooleanfalseStarts paused when uncontrolled.
onPausedChange(paused: boolean) => void–Called from the pause button. Use it to close or pause your own subscription.
hidePausebooleanfalseHides the pause button.
label(count: number) => string"people on the site now"The words after the number, pluralized from the count. Use it for "in the app now" or "watching the stream".
maxPagesnumber4How many pages to list.
maxEventsnumber4How many events to list.
titlestring"Live visitors"Accessible name of the card.
classNamestring–Extra class on the card. It is at most 640px wide and fills narrower containers.

useLiveVisitorsSimulation

The simulated stream behind the default demo, for prototypes and tests: about 128 people, a new arrival every 600ms, drifting page counts and a signup or upgrade every 2.4s. Nothing is fetched or tracked.

PropTypeDefaultDescription
activebooleantrueHolds the stream when false. Returns { count, pages, visitors, events }.

Keyboard interactions

KeysAction
TabReaches the pause button. The map and lists are read-only.
Enter / SpacePauses or resumes live updates.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in ai

Guidance for AI tools

Live visitors: A realtime visitors card where the live count rolls digit by digit, new arrivals ping in on a dotted world map, the top pages reorder with bars, and signups and upgrades tick in with country flags. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components