Data JS behaviour

Analytics card

A stat card with a period switch: the thumb slides, the headline rolls and the bars grow or shrink into the new period one after another.

Real scenarios

The component as it is used in a product — not a specimen grid.

Visitors, on the marketing wall

Switch the period: the thumb slides to it, the headline rolls and the bars grow or shrink one after another. The 90-day delta is negative — and honestly shown.

Visitors

18,420 +12.5%

vs previous 7 days

Visitors · 7d
Mon2,500
Tue2,699
Wed2,896
Thu3,359
Fri3,038
Sat3,113
Sun3,190

Downloads in a product card

Two quieter periods and format shaping the numbers — the same card inside a release announcement.

CLI downloads

5,310 +8.8%

vs last week

CLI downloads · This week
Mon740
Tue803
Wed864
Thu1,010
Fri909
Sat933
Sun957

Important props

Important props
Prop Type Default What it does
periods array [] Each period: ['id' => …, 'label' => …, 'value' => …, 'delta' => …, 'values' => […], 'labels' => […], 'caption' => …].
active string null The starting period id.
format / invertDelta array / bool null / false Intl.NumberFormat options for the numbers, and reading a falling delta as good.

Snippet

<x-nx::analytics-card title="بازدیدها" active="7d" :periods="$periods" />