Skip to content

Examples

Analytics overview

A dashboard header where one range select feeds three stat cards and the tab panels beneath them.

Preview

Analytics

Total revenue

$15,231.89

+20.1%
Compared with May 2027.

Subscriptions

2,350

+180.1%
Net of churn.

Active now

573

201
Peak was 612 at 11:00.
HTML
<bs:bsui-stack direction="column" gap="4" align="stretch">
  <bs:bsui-stack direction="row" gap="3" align="center" justify="space-between">
    <bs:bsui-text content="Analytics" variant="title" tag="h2" />
    <bs:bsui-select name="range" defaultValue="30" placeholder="Range">
      <bs:bsui-select-trigger />
      <bs:bsui-select-popup>
        <bs:bsui-select-option value="7" label="Last 7 days" />
        <bs:bsui-select-option value="30" label="Last 30 days" />
        <bs:bsui-select-option value="90" label="Last 90 days" />
      </bs:bsui-select-popup>
    </bs:bsui-select>
  </bs:bsui-stack>
  <bs:bsui-stack direction="row" gap="3" align="stretch">
    <bs:bsui-card>
      <bs:bsui-card-header>
        <bs:bsui-card-description label="Total revenue" />
      </bs:bsui-card-header>
      <bs:bsui-card-content>
        <bs:bsui-stack direction="row" gap="2" align="center">
          <bs:bsui-text content="$15,231.89" variant="heading" tag="p" />
          <bs:bsui-badge label="+20.1%" variant="success" />
        </bs:bsui-stack>
        <bs:bsui-text content="Compared with May 2027." variant="caption" tag="span" />
      </bs:bsui-card-content>
    </bs:bsui-card>
    <bs:bsui-card>
      <bs:bsui-card-header>
        <bs:bsui-card-description label="Subscriptions" />
      </bs:bsui-card-header>
      <bs:bsui-card-content>
        <bs:bsui-stack direction="row" gap="2" align="center">
          <bs:bsui-text content="2,350" variant="heading" tag="p" />
          <bs:bsui-badge label="+180.1%" variant="success" />
        </bs:bsui-stack>
        <bs:bsui-text content="Net of churn." variant="caption" tag="span" />
      </bs:bsui-card-content>
    </bs:bsui-card>
    <bs:bsui-card>
      <bs:bsui-card-header>
        <bs:bsui-card-description label="Active now" />
      </bs:bsui-card-header>
      <bs:bsui-card-content>
        <bs:bsui-stack direction="row" gap="2" align="center">
          <bs:bsui-text content="573" variant="heading" tag="p" />
          <bs:bsui-badge label="+201" variant="secondary" />
        </bs:bsui-stack>
        <bs:bsui-text content="Peak was 612 at 11:00." variant="caption" tag="span" />
      </bs:bsui-card-content>
    </bs:bsui-card>
  </bs:bsui-stack>
  <bs:bsui-tabs defaultValue="overview">
    <bs:bsui-tabs-list>
      <bs:bsui-tabs-trigger value="overview" title="Overview" />
      <bs:bsui-tabs-trigger value="traffic" title="Traffic" />
      <bs:bsui-tabs-trigger value="conversions" title="Conversions" />
    </bs:bsui-tabs-list>
    <bs:bsui-tabs-panel value="overview">
      <bs:bsui-text content="Revenue is pacing 12% ahead of last month." variant="muted" />
    </bs:bsui-tabs-panel>
    <bs:bsui-tabs-panel value="traffic">
      <bs:bsui-text content="Search remains the largest channel at 44% of sessions." variant="muted" />
    </bs:bsui-tabs-panel>
    <bs:bsui-tabs-panel value="conversions">
      <bs:bsui-text content="Checkout conversion held at 3.1% this week." variant="muted" />
    </bs:bsui-tabs-panel>
  </bs:bsui-tabs>
</bs:bsui-stack>

How it works

The range select writes the window into a context that every stat card derives its value and delta from, so one change repaints all three. The tabs store swaps the analysis panels without touching that shared range.

Every behaviour on this page is the WordPress Interactivity API: each component registers its own store, seeds its state in a server rendered context, and wires events with directives in the markup above. There is no page specific JavaScript.