Realtime Visitors
1 variantA 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- /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>
);
}
Source code is locked
Get access to install premium components and view the full source.
Open dashboardInstall
API Reference
Every prop is optional unless marked required. Data, copy, and colors default to the sample content.
RealtimeVisitors19 props
citiesCities with their starting visitors; their sum is the starting live count.
RealtimeCity[]pagesPages with their starting visitors.
RealtimeRow[]referrersReferrers with their starting visitors.
RealtimeRow[]minutesLive count at the end of each of the last minutes, oldest first.
number[]eventsArrivals on screen at mount, newest first.
RealtimeEvent[]maxEventsMost arrivals shown under the list. Set 0 to hide them.
numberDefault
3liveSimulate arrivals and departures. Set false to show the data as given.
booleanDefault
trueintervalMsTime between simulated arrivals or departures, in ms.
numberDefault
1600ticksPerMinuteTicks that make one simulated minute on the bars.
numberDefault
6maxRowsMost rows in the list.
numberDefault
5tabControlled list tab.
"pages" | "referrers" | "countries"defaultTabList tab when uncontrolled.
"pages" | "referrers" | "countries"Default
pagesonTabChangeCalled when a list tab is chosen.
((tab: RealtimeTab) => void)accentColorMap marker and ping color. Any CSS color.
stringDefault
#10b981accentClassNameLive dot and newest bar color class.
stringDefault
bg-emerald-500barClassNamesList share bar color class for each tab; any tab left out keeps its default.
Partial<Record<RealtimeTab, string>>formatValueFormats visitor counts in the map tooltip.
((value: number) => string)Default
(value: number) => numberFormat.format(value)labelsCopy overrides; anything left out uses the English defaults.
Partial<RealtimeVisitorsLabels>classNameClasses merged onto the root element.
string
ActiveList8 props
rowsRequiredRows per tab.
Record<RealtimeTab, RealtimeRow[]>tabRequiredSelected tab.
"pages" | "referrers" | "countries"onTabChangeRequiredCalled when a tab is chosen.
(tab: RealtimeTab) => voidmaxRowsRequiredMost rows shown at once.
numberreduceRequiredSkip movement, keep fades.
booleanlabelsRequiredCopy for tabs, headings and the empty state.
RealtimeVisitorsLabelsbarClassNamesRequiredShare bar color class for each tab.
Record<RealtimeTab, string>onPauseChangeRequiredCalled with true while the pointer or focus is in the list, to pause the feed.
(paused: boolean) => void
ActiveRow7 props
rowRequiredThe row to draw.
RealtimeRowtabRequiredWhich list the row belongs to; pages render the label in mono.
"pages" | "referrers" | "countries"shareRequiredBar width as a share of the largest row, 0 to 1.
numberdelayRequiredEntrance delay in seconds; 0 for rows that arrive after mount.
numberreduceRequiredSkip movement, keep fades.
booleanbarClassNameRequiredShare bar color class, such as `bg-emerald-500/15`.
stringrefThe row element, so AnimatePresence can pop exiting rows out of the flow.
Ref<HTMLLIElement>
ActivityFeed9 props
eventsRequiredArrivals, newest first.
RealtimeEvent[]clockRequiredFeed seconds now, used to age each arrival.
numbermaxEventsRequiredRows kept on screen; the list holds this height so nothing below jumps.
numberactiveCityIdRequiredCity id lit on the map, so its rows read as selected.
string | nullonActiveCityChangeRequiredCalled with a city id while a row is hovered, and null when it leaves.
(cityId: string | null) => voidreduceRequiredSkip movement, keep fades.
booleanlabelsRequiredCopy for the heading, ages and the page/referrer joiner.
RealtimeVisitorsLabelsaccentClassNameRequiredDot color class for the newest arrival, such as `bg-emerald-500`.
stringonPauseChangeCalled with true while the pointer is over the arrivals, so rows hold still to be read.
((paused: boolean) => void)
DeltaPill4 props
fromRequiredEarlier value to compare against.
numbertoRequiredCurrent value.
numbersuffixRequiredText after the pill, such as "vs 30 min ago".
stringclassNameClasses merged onto the root element.
string
LiveHeader7 props
totalRequiredVisitors online now.
numberminutesRequiredPer-minute values for the bars, with one off-screen bar on the left.
number[]minuteTickRequiredIncrements on each new minute.
numberrunningRequiredTrue while the feed is running; drives the dot's pulse and status text.
booleanreduceRequiredSkip loops and movement.
booleanlabelsRequiredCopy for the title, status and captions.
RealtimeVisitorsLabelsaccentClassNameRequiredLive dot and newest bar color class, such as `bg-emerald-500`.
string
MinuteBars7 props
valuesRequiredPer-minute values, oldest first, with one extra bar on the left that sits off-screen.
number[]tickRequiredIncrements when a new minute rolls in; replays the slide.
numberreduceRequiredSkip the slide and growth animations.
booleanbarClassNameClass for the newest bar, such as `bg-emerald-500`.
stringDefault
bg-emerald-500restClassNameClass for the older bars.
stringDefault
bg-foreground/30labelRequiredAccessible summary of the chart.
stringclassNameClasses merged onto the root element.
string
useVisitorFeed9 props
citiesRequiredCities with their starting visitors.
RealtimeCity[]pagesRequiredPages with their starting visitors.
RealtimeRow[]referrersRequiredReferrers with their starting visitors.
RealtimeRow[]minutesRequiredLive count at the end of each past minute, oldest first.
number[]eventsRequiredArrivals already on screen, newest first.
RealtimeEvent[]maxEventsRequiredMost arrivals kept.
numberactiveRequiredRun the simulation only while true.
booleanintervalMsRequiredTime between simulated arrivals or departures, in ms.
numberticksPerMinuteRequiredTicks that make one simulated minute on the bar chart.
number
VisitorMap7 props
citiesRequiredCities with their live visitors and ping counter.
(RealtimeCity & { pulse: number; })[]colorRequiredMarker and ping color. Any CSS color.
stringlabelRequiredAccessible name for the map.
stringunitRequiredNoun after the visitor count in the tooltip.
stringformatValueRequiredFormats visitor counts.
(value: number) => stringactiveIdRequiredCity id whose marker is lit and shows its tooltip.
string | nullonActiveChangeRequiredCalled 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
idRequiredStable id, used as the map marker key.
stringcityRequiredCity name shown in the tooltip.
stringcountryRequiredCountry name shown under the city.
stringcountryCodeRequiredISO 3166 two-letter code, shown as a chip in the Countries list.
stringlatRequiredLatitude in degrees, north positive.
numberlngRequiredLongitude in degrees, east positive.
numbervisitorsRequiredVisitors on the site from this city right now; 0 hides the marker.
number
RealtimeRow4 fields
idRequiredStable id, used as the row key.
stringlabelRequiredPath, referrer domain or country name.
stringvisitorsRequiredVisitors on this row right now.
numbercodeTwo-letter code chip before the label, used by country rows.
string
RealtimeEvent7 fields
idRequiredStable id, used as the row key.
stringcityIdRequiredId of the city the visitor came from, so hovering the row lights its marker.
stringcityRequiredCity name shown in the row.
stringcountryCodeRequiredISO 3166 two-letter code shown as a chip.
stringpageRequiredPage the visitor landed on.
stringreferrerRequiredWhere the visitor came from.
stringatRequiredWhen it happened, in feed seconds; negative for events before the block mounted.
number
RealtimeVisitorsLabels19 fields
titleRequiredHeading above the live count.
stringliveRequiredText beside the pulsing dot while the feed runs.
stringpausedRequiredText beside the dot while the feed is paused or off.
stringvisitorsRequiredNoun after the live count.
stringunitRequiredNoun after a city's count in the map tooltip.
stringminutesRequiredAccessible name of the per-minute bars.
stringminutesStartRequiredCaption under the oldest bar.
stringminutesEndRequiredCaption under the newest bar.
stringdeltaRequiredText after the change pill beside the count.
stringactivityRequiredHeading above the latest arrivals.
stringnowRequiredAge shown for arrivals under five seconds old.
stringfromRequiredJoins the page and referrer in an arrival row, as in "/pricing from google.com".
stringmapRequiredAccessible name for the map.
stringpagesRequiredPages tab label.
stringreferrersRequiredReferrers tab label.
stringcountriesRequiredCountries tab label.
stringtabsRequiredAccessible name for the list tabs.
stringcountRequiredRight column heading in the list.
stringemptyRequiredShown when the selected list has no rows.
string