Realtime Visitors

1 variant

A live analytics panel with a rolling visitor count, a dotted world map of visitor pings, and a ranked list of active pages.

Live visitors

A live visitor panel with a rolling count, a change pill, and per-minute bars, a dotted world map that pings at visitor cities, a Pages, Referrers, and Countries list that reorders as counts change, and a stream of latest arrivals that lights each visitor's city on hover.

Right now

Paused
124visitors online29%vs 30 min ago
30 min agoNow
PagesVisitors
  • /31
  • /pricing22
  • /docs/getting-started18
  • /blog/edge-caching15
  • /changelog12

Latest arrivals

  • DEBerlin/pricing from google.comnow
  • INBengaluru/docs/getting-started from github.com14s
  • USSan Francisco/ from news.ycombinator.com27s
"use client";

import { RealtimeVisitors } from "@/components/premium/realtime-visitors";

export function RealtimeVisitorsLivePreview() {
  return (
    <div className="w-full px-4 py-10">
      <RealtimeVisitors />
    </div>
  );
}

Install

$ bunx --bun shadcn add @beui-pro/realtime-visitors-live

API Reference

Every prop is optional unless marked required. Data, copy, and colors default to the sample content.

RealtimeVisitors19 props
  • cities

    Cities with their starting visitors; their sum is the starting live count.

    RealtimeCity[]
  • pages

    Pages with their starting visitors.

    RealtimeRow[]
  • referrers

    Referrers with their starting visitors.

    RealtimeRow[]
  • minutes

    Live count at the end of each of the last minutes, oldest first.

    number[]
  • events

    Arrivals on screen at mount, newest first.

    RealtimeEvent[]
  • maxEvents

    Most arrivals shown under the list. Set 0 to hide them.

    number

    Default 3

  • live

    Simulate arrivals and departures. Set false to show the data as given.

    boolean

    Default true

  • intervalMs

    Time between simulated arrivals or departures, in ms.

    number

    Default 1600

  • ticksPerMinute

    Ticks that make one simulated minute on the bars.

    number

    Default 6

  • maxRows

    Most rows in the list.

    number

    Default 5

  • tab

    Controlled list tab.

    "pages" | "referrers" | "countries"
  • defaultTab

    List tab when uncontrolled.

    "pages" | "referrers" | "countries"

    Default pages

  • onTabChange

    Called when a list tab is chosen.

    ((tab: RealtimeTab) => void)
  • accentColor

    Map marker and ping color. Any CSS color.

    string

    Default #10b981

  • accentClassName

    Live dot and newest bar color class.

    string

    Default bg-emerald-500

  • barClassNames

    List share bar color class for each tab; any tab left out keeps its default.

    Partial<Record<RealtimeTab, string>>
  • formatValue

    Formats visitor counts in the map tooltip.

    ((value: number) => string)

    Default (value: number) => numberFormat.format(value)

  • labels

    Copy overrides; anything left out uses the English defaults.

    Partial<RealtimeVisitorsLabels>
  • className

    Classes merged onto the root element.

    string
ActiveList8 props
  • rowsRequired

    Rows per tab.

    Record<RealtimeTab, RealtimeRow[]>
  • tabRequired

    Selected tab.

    "pages" | "referrers" | "countries"
  • onTabChangeRequired

    Called when a tab is chosen.

    (tab: RealtimeTab) => void
  • maxRowsRequired

    Most rows shown at once.

    number
  • reduceRequired

    Skip movement, keep fades.

    boolean
  • labelsRequired

    Copy for tabs, headings and the empty state.

    RealtimeVisitorsLabels
  • barClassNamesRequired

    Share bar color class for each tab.

    Record<RealtimeTab, string>
  • onPauseChangeRequired

    Called with true while the pointer or focus is in the list, to pause the feed.

    (paused: boolean) => void
ActiveRow7 props
  • rowRequired

    The row to draw.

    RealtimeRow
  • tabRequired

    Which list the row belongs to; pages render the label in mono.

    "pages" | "referrers" | "countries"
  • shareRequired

    Bar width as a share of the largest row, 0 to 1.

    number
  • delayRequired

    Entrance delay in seconds; 0 for rows that arrive after mount.

    number
  • reduceRequired

    Skip movement, keep fades.

    boolean
  • barClassNameRequired

    Share bar color class, such as `bg-emerald-500/15`.

    string
  • ref

    The row element, so AnimatePresence can pop exiting rows out of the flow.

    Ref<HTMLLIElement>
ActivityFeed9 props
  • eventsRequired

    Arrivals, newest first.

    RealtimeEvent[]
  • clockRequired

    Feed seconds now, used to age each arrival.

    number
  • maxEventsRequired

    Rows kept on screen; the list holds this height so nothing below jumps.

    number
  • activeCityIdRequired

    City id lit on the map, so its rows read as selected.

    string | null
  • onActiveCityChangeRequired

    Called with a city id while a row is hovered, and null when it leaves.

    (cityId: string | null) => void
  • reduceRequired

    Skip movement, keep fades.

    boolean
  • labelsRequired

    Copy for the heading, ages and the page/referrer joiner.

    RealtimeVisitorsLabels
  • accentClassNameRequired

    Dot color class for the newest arrival, such as `bg-emerald-500`.

    string
  • onPauseChange

    Called with true while the pointer is over the arrivals, so rows hold still to be read.

    ((paused: boolean) => void)
DeltaPill4 props
  • fromRequired

    Earlier value to compare against.

    number
  • toRequired

    Current value.

    number
  • suffixRequired

    Text after the pill, such as "vs 30 min ago".

    string
  • className

    Classes merged onto the root element.

    string
LiveHeader7 props
  • totalRequired

    Visitors online now.

    number
  • minutesRequired

    Per-minute values for the bars, with one off-screen bar on the left.

    number[]
  • minuteTickRequired

    Increments on each new minute.

    number
  • runningRequired

    True while the feed is running; drives the dot's pulse and status text.

    boolean
  • reduceRequired

    Skip loops and movement.

    boolean
  • labelsRequired

    Copy for the title, status and captions.

    RealtimeVisitorsLabels
  • accentClassNameRequired

    Live dot and newest bar color class, such as `bg-emerald-500`.

    string
MinuteBars7 props
  • valuesRequired

    Per-minute values, oldest first, with one extra bar on the left that sits off-screen.

    number[]
  • tickRequired

    Increments when a new minute rolls in; replays the slide.

    number
  • reduceRequired

    Skip the slide and growth animations.

    boolean
  • barClassName

    Class for the newest bar, such as `bg-emerald-500`.

    string

    Default bg-emerald-500

  • restClassName

    Class for the older bars.

    string

    Default bg-foreground/30

  • labelRequired

    Accessible summary of the chart.

    string
  • className

    Classes merged onto the root element.

    string
useVisitorFeed9 props
  • citiesRequired

    Cities with their starting visitors.

    RealtimeCity[]
  • pagesRequired

    Pages with their starting visitors.

    RealtimeRow[]
  • referrersRequired

    Referrers with their starting visitors.

    RealtimeRow[]
  • minutesRequired

    Live count at the end of each past minute, oldest first.

    number[]
  • eventsRequired

    Arrivals already on screen, newest first.

    RealtimeEvent[]
  • maxEventsRequired

    Most arrivals kept.

    number
  • activeRequired

    Run the simulation only while true.

    boolean
  • intervalMsRequired

    Time between simulated arrivals or departures, in ms.

    number
  • ticksPerMinuteRequired

    Ticks that make one simulated minute on the bar chart.

    number
VisitorMap7 props
  • citiesRequired

    Cities with their live visitors and ping counter.

    (RealtimeCity & { pulse: number; })[]
  • colorRequired

    Marker and ping color. Any CSS color.

    string
  • labelRequired

    Accessible name for the map.

    string
  • unitRequired

    Noun after the visitor count in the tooltip.

    string
  • formatValueRequired

    Formats visitor counts.

    (value: number) => string
  • activeIdRequired

    City id whose marker is lit and shows its tooltip.

    string | null
  • onActiveChangeRequired

    Called when a marker is hovered, focused or left.

    (id: string | null) => void
Types4 types

The object types these props take, field by field.

RealtimeCity7 fields
  • idRequired

    Stable id, used as the map marker key.

    string
  • cityRequired

    City name shown in the tooltip.

    string
  • countryRequired

    Country name shown under the city.

    string
  • countryCodeRequired

    ISO 3166 two-letter code, shown as a chip in the Countries list.

    string
  • latRequired

    Latitude in degrees, north positive.

    number
  • lngRequired

    Longitude in degrees, east positive.

    number
  • visitorsRequired

    Visitors on the site from this city right now; 0 hides the marker.

    number
RealtimeRow4 fields
  • idRequired

    Stable id, used as the row key.

    string
  • labelRequired

    Path, referrer domain or country name.

    string
  • visitorsRequired

    Visitors on this row right now.

    number
  • code

    Two-letter code chip before the label, used by country rows.

    string
RealtimeEvent7 fields
  • idRequired

    Stable id, used as the row key.

    string
  • cityIdRequired

    Id of the city the visitor came from, so hovering the row lights its marker.

    string
  • cityRequired

    City name shown in the row.

    string
  • countryCodeRequired

    ISO 3166 two-letter code shown as a chip.

    string
  • pageRequired

    Page the visitor landed on.

    string
  • referrerRequired

    Where the visitor came from.

    string
  • atRequired

    When it happened, in feed seconds; negative for events before the block mounted.

    number
RealtimeVisitorsLabels19 fields
  • titleRequired

    Heading above the live count.

    string
  • liveRequired

    Text beside the pulsing dot while the feed runs.

    string
  • pausedRequired

    Text beside the dot while the feed is paused or off.

    string
  • visitorsRequired

    Noun after the live count.

    string
  • unitRequired

    Noun after a city's count in the map tooltip.

    string
  • minutesRequired

    Accessible name of the per-minute bars.

    string
  • minutesStartRequired

    Caption under the oldest bar.

    string
  • minutesEndRequired

    Caption under the newest bar.

    string
  • deltaRequired

    Text after the change pill beside the count.

    string
  • activityRequired

    Heading above the latest arrivals.

    string
  • nowRequired

    Age shown for arrivals under five seconds old.

    string
  • fromRequired

    Joins the page and referrer in an arrival row, as in "/pricing from google.com".

    string
  • mapRequired

    Accessible name for the map.

    string
  • pagesRequired

    Pages tab label.

    string
  • referrersRequired

    Referrers tab label.

    string
  • countriesRequired

    Countries tab label.

    string
  • tabsRequired

    Accessible name for the list tabs.

    string
  • countRequired

    Right column heading in the list.

    string
  • emptyRequired

    Shown when the selected list has no rows.

    string