Traffic Card

NEW

A compact traffic block with a count-up visit total, a Day / Week switcher, and a stacked column chart where every channel is its own rounded capsule. Built with hand-written SVG, light and dark themes, and full keyboard support.

Traffic

Last 22 days

30,895visits

Oct 27Nov 17

Traffic by channel, Day (Last 22 days)
IntervalDirectReferralSocialSearchPaidTotal
Oct 272423964553472931,733
Oct 282543485153702971,784
Oct 292563383742632891,520
Oct 302323594662892891,635
Oct 312063053272982251,361
Nov 012193243852902291,447
Nov 022594204363033411,759
Nov 032304414962932571,717
Nov 041773303522782251,362
Nov 052133243392701991,345
Nov 061482583051922021,105
Nov 07127180237147138829
Nov 08145203234207161950
Nov 091302232841761981,011
Nov 101773032702511921,193
Nov 111583303552182301,291
Nov 121912923042172481,252
Nov 131593413482712501,369
Nov 142142793362372791,345
Nov 152163284533093241,630
Nov 162153793852522311,462
Nov 172624444313473111,795
All4,4307,1458,0875,8255,40830,895

Installation

Add the component directly to your repository using shadcn CLI:

npx shadcn@latest add Surajmaurya1/easyui/traffic-card

API Reference

PropTypeDefaultDescription
rangesTrafficRange[]—Switchable ranges, each with its own points, caption, and optional total
channelsTrafficChannel[]—Channel definitions rendered bottom-to-top in every stacked column
defaultRangestringfirst rangeRange id selected on first render
onRangeChange(id: string) => void—Called when the visitor switches the Day / Week control
titlestring"Traffic"Heading shown at the top of the card
unitstring"visits"Noun displayed beside the headline number
format(n: number) => stringrounded Intl.NumberFormatFormats the headline, tooltip values, and screen-reader table
heightnumber132Chart height in pixels
animatedbooleantrueCount-up and column entrance animations (disabled for reduced motion)
classNamestring""Additional CSS classes for the card
TrafficRange.pointsTrafficPoint[]—One column per entry, ordered oldest to newest
TrafficPoint.valuesRecord<string, number>—Channel id → visits for that interval
TrafficChannel.colorstring—Optional CSS color; defaults to the built-in traffic palette