beUI Pro

Traffic Sources

1 バリエーション

An acquisition panel that shows where visitors come from by source, medium, or campaign, with favicons, share bars, and trend sparklines.

Source list

Where visitors come from by source, medium, or campaign over 7, 30, or 90 days, with real favicons, filled share bars, rolling counts, change deltas, and trend sparklines. Rows glide to their new rank when the period changes, and each row opens its bounce rate, conversion, and top landing pages.

Traffic sources

73,652visitorsup10%vs previous period
SourceVisitors
  • 26,048up11%
  • 15,243up9%
  • 6,749up18%
  • 5,900up38%
  • 5,126up4%
  • 3,765up7%

Top source google.com · 35% of visits · 12 sources

"use client";

import { TrafficSources } from "@/components/premium/traffic-sources";

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

インストール

$ bunx --bun shadcn add @beui-pro/traffic-sources-list

API リファレンス

必須と記された props 以外はすべて省略できます。データ、文言、色はサンプルの内容が既定値です。

TrafficSources16 個の props
  • data

    Totals and rows for every period and grouping.

    TrafficSourcesData
  • period

    Controlled period.

    "7d" | "30d" | "90d"
  • defaultPeriod

    Period when uncontrolled.

    "7d" | "30d" | "90d"

    既定値 30d

  • onPeriodChange

    Called when a period is chosen.

    ((period: TrafficPeriod) => void)
  • dimension

    Controlled grouping.

    "source" | "medium" | "campaign"
  • defaultDimension

    Grouping when uncontrolled.

    "source" | "medium" | "campaign"

    既定値 source

  • onDimensionChange

    Called when a grouping is chosen.

    ((dimension: TrafficDimension) => void)
  • maxRows

    Most rows in the list.

    number

    既定値 6

  • periodLabels

    Period tab labels; any period left out keeps its default.

    Partial<Record<TrafficPeriod, string>>
  • barClassNames

    Filled share bar class for each grouping; any left out keeps its default.

    Partial<Record<TrafficDimension, string>>
  • strokeClassNames

    Sparkline stroke class for each grouping; any left out keeps its default.

    Partial<Record<TrafficDimension, string>>
  • formatNumber

    Formats visitor counts in the detail strip.

    ((value: number) => string)
  • formatPercent

    Formats rates and shares, given as 0 to 1.

    ((value: number) => string)
  • formatFooter

    Builds the footer line from the top row, its share and the row count.

    ((info: TrafficFooterInfo) => string)
  • labels

    Copy overrides; anything left out uses the English defaults.

    Partial<TrafficSourcesLabels>
  • className

    Classes merged onto the root element.

    string
ChangeDelta4 個の props
  • from必須

    Value in the previous period.

    number
  • to必須

    Value in the selected period.

    number
  • variant

    `pill` draws a tinted pill for the header; `inline` draws small colored text for rows.

    "inline" | "pill"

    既定値 inline

  • className

    Classes merged onto the root element.

    string
SourceDetail7 個の props
  • id必須

    Element id, referenced by the row toggle's `aria-controls`.

    string
  • pages必須

    Top landing pages for the row.

    TrafficLandingPage[]
  • total必須

    Row visitors, used for each page's share.

    number
  • heading必須

    Heading above the pages.

    string
  • reduce必須

    Skip movement, keep fades.

    boolean
  • formatNumber必須

    Formats visitor counts.

    (value: number) => string
  • formatPercent必須

    Formats each page's share of the row.

    (value: number) => string
SourceFavicon4 個の props
  • domain

    Site domain to load the favicon for.

    string
  • icon

    Fallback icon when there is no domain or the favicon fails.

    "search" | "email" | "paid" | "campaign" | "direct" | "social" | "referral"
  • label必須

    Row label, used for the initial when there is no icon either.

    string
  • className

    Classes merged onto the root element.

    string
SourceList13 個の props
  • rows必須

    Rows for the selected period and grouping.

    TrafficSourceRow[]
  • total必須

    All visitors in the period, for each row's share of visits.

    number
  • period必須

    Selected period; a change redraws the sparklines.

    "7d" | "30d" | "90d"
  • dimension必須

    Selected grouping.

    "source" | "medium" | "campaign"
  • dimensions必須

    Groupings offered, in display order.

    TrafficDimension[]
  • onDimensionChange必須

    Called when a grouping tab is chosen.

    (dimension: TrafficDimension) => void
  • maxRows必須

    Most rows shown at once.

    number
  • reduce必須

    Skip movement, keep fades.

    boolean
  • labels必須

    Copy for tabs, headings, tooltip and the empty state.

    TrafficSourcesLabels
  • barClassNames必須

    Filled share bar class for each grouping.

    Record<TrafficDimension, string>
  • strokeClassNames必須

    Sparkline stroke class for each grouping.

    Record<TrafficDimension, string>
  • formatNumber必須

    Formats visitor counts in the detail strip.

    (value: number) => string
  • formatPercent必須

    Formats rates and shares.

    (value: number) => string
SourceRow14 個の props
  • row必須

    The row to draw.

    TrafficSourceRow
  • share必須

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

    number
  • visitShare必須

    The row's share of all visitors in the period, 0 to 1, shown in the tooltip.

    number
  • trendKey必須

    Changes when the period changes, so the sparkline draws in again.

    string
  • delay必須

    Entrance delay in seconds; 0 for rows that join after the list opens.

    number
  • reduce必須

    Skip movement, keep fades.

    boolean
  • expanded必須

    True while the landing pages strip is open.

    boolean
  • onToggle必須

    Called when the row is clicked or activated by keyboard.

    () => void
  • barClassName必須

    Filled share bar class, such as `bg-sky-500/15`.

    string
  • strokeClassName必須

    Sparkline stroke class, such as `stroke-sky-500`.

    string
  • labels必須

    Copy for the tooltip, toggle hint and detail heading.

    TrafficSourcesLabels
  • formatNumber必須

    Formats visitor counts in the detail strip.

    (value: number) => string
  • formatPercent必須

    Formats rates in the tooltip.

    (value: number) => string
  • ref

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

    Ref<HTMLLIElement>
TrafficHeader6 個の props
  • total必須

    Totals for the selected period.

    TrafficPeriodTotal
  • period必須

    Selected period.

    "7d" | "30d" | "90d"
  • periods必須

    Periods offered, in display order.

    TrafficPeriod[]
  • periodLabels必須

    Tab label for each period.

    Record<TrafficPeriod, string>
  • onPeriodChange必須

    Called when a period is chosen.

    (period: TrafficPeriod) => void
  • labels必須

    Copy for the title, noun and change caption.

    TrafficSourcesLabels
型5 個の型

これらの props が受け取るオブジェクト型とそのフィールド。

TrafficFooterInfo4 個のフィールド
  • dimension必須

    Selected grouping.

    TrafficDimension
  • top

    The largest row, or undefined when the list is empty.

    TrafficSourceRow
  • share必須

    Top row's share of all visitors in the period, 0 to 1.

    number
  • count必須

    Number of rows in the selected grouping.

    number
TrafficSourcesLabels15 個のフィールド
  • title必須

    Card heading.

    string
  • visitors必須

    Noun after the total.

    string
  • delta必須

    Text after the change pill beside the total.

    string
  • periods必須

    Accessible name for the period tabs.

    string
  • dimensions必須

    Accessible name for the grouping tabs.

    string
  • source必須

    Source tab label.

    string
  • medium必須

    Medium tab label.

    string
  • campaign必須

    Campaign tab label.

    string
  • count必須

    Right column heading in the list.

    string
  • bounce必須

    Bounce rate label in the row tooltip.

    string
  • conversion必須

    Conversion label in the row tooltip.

    string
  • share必須

    Share of visits label in the row tooltip.

    string
  • landing必須

    Heading of the expanded landing pages strip.

    string
  • expand必須

    Accessible hint on each row's toggle.

    string
  • empty必須

    Shown when the selected grouping has no rows.

    string
TrafficSourceRow10 個のフィールド
  • id必須

    Stable id, used as the row key so rows glide between periods.

    string
  • label必須

    Domain, channel or campaign name shown in the row.

    string
  • domain

    Site domain; when set, the row shows that site's favicon.

    string
  • icon

    Fallback icon when there is no domain or the favicon fails to load.

    TrafficSourceIcon
  • visitors必須

    Visitors in the selected period.

    number
  • previous必須

    Visitors in the period before it, for the change figure.

    number
  • bounceRate必須

    Share of visits that left after one page, 0 to 1.

    number
  • conversionRate必須

    Share of visits that converted, 0 to 1.

    number
  • trend必須

    Visitors per day (or per bucket) across the period, oldest first.

    number[]
  • landingPages

    Top landing pages for this row, shown when the row is expanded.

    TrafficLandingPage[]
TrafficLandingPage2 個のフィールド
  • path必須

    Page path, such as `/pricing`.

    string
  • visitors必須

    Visitors from this row who landed on the page.

    number
TrafficPeriodTotal2 個のフィールド
  • visitors必須

    All visitors in the period.

    number
  • previous必須

    All visitors in the period before it.

    number