Dashboards
Overview screens: analytics, a conversion funnel, a usage report, a spend overview and a personal bank’s home.
Installation & usage
npx @youj/cli add app-analytics-overviewAlso installs alert, app-page, badge, button, card, chart, counter, date-range-picker, empty, field, icon-pencil, reveal, skeleton, sparkline, stat-card, table, toggle-group, treemap, use-announcer, use-controllable-state, use-now, youj-core, youj-ui-core.
The CLI copies the block to blocks/app/analytics-overview.tsx with every component it uses, so it’s yours to edit.
Every prop is optional and falls back to the demo, so it renders as you see it until you pass your own. Give it your data, rewrite or translate its strings through copy, and connect its actions:
'use client'
import { AnalyticsOverview, type AnalyticsOverviewProps } from '@/blocks/app/analytics-overview'
export function AnalyticsOverviewView({ range, summary, kpis, metric }: Pick<AnalyticsOverviewProps, 'range' | 'summary' | 'kpis' | 'metric'>) {
return (
<AnalyticsOverview
range={range}
summary={summary}
kpis={kpis}
metric={metric}
copy={{ title: 'Analytics overview' }}
onRangeChange={(range) => {
// your code
}}
onMetricChange={(metric) => {
// your code
}}
onRetry={() => {
// your code
}}
/>
)
}Description
See how a store did over any date range: headline numbers, a trend against the previous period, channels, categories and top products.
See how a store did over any date range: headline numbers, a trend against the previous period, channels, categories and top products.
Follow trial teams to paid: a conversion funnel, step changes against the previous period, cohort retention, time to paid and daily upgrades.
Follow trial teams to paid: a conversion funnel, step changes against the previous period, cohort retention, time to paid and daily upgrades.
Track cloud spending against a budget with a projected bill, usage breakdown, a spend cap and invoices.
Track cloud spending against a budget with a projected bill, usage breakdown, a spend cap and invoices.
See where a workspace’s money is going and whether it lasts the month: the spend so far with its change and one plain status, the running total carried to the period’s end against the limit, the latest requests with their failures, the audit trail, and cards for your usage, the top spenders and billing.
See where a workspace’s money is going and whether it lasts the month: the spend so far with its change and one plain status, the running total carried to the period’s end against the limit, the latest requests with their failures, the audit trail, and cards for your usage, the top spenders and billing.
Code
Analytics Overview, the Analytics story: the files youj add writes.
blocks/app
Reference
Props22 props, 8 types
Props
| Prop | Type | |
|---|---|---|
theme | ThemeInputWraps the block in this theme. Default: the theme around it. | – |
embedded | booleanA page in your app's frame: the shared page header (AppPage) and the frame's gutter, across the whole width, with no store header of its own. default true | true |
headingLevel | 1 | 2 | 3The title's level. default 1 | 1 |
range | DateSpanThe span shown (controlled); pair it with | – |
defaultRange | DateSpanThe span shown first. Default: the last 30 days. | – |
onRangeChange | (range: DateSpan) => voidCalled with each complete span the picker settles on. | – |
summary | SummaryThe page's figures for the span shown, from your analytics API. Default: the demo store's, computed for the span. | – |
kpis | AnalyticsKpi[]The headline numbers, in order. default revenue, orders, conversion rate and average order | revenue, orders, conversion rate and average order |
metric | Metric'revenue''orders''visitors'The trend chart's metric (controlled); pair it with | – |
defaultMetric | Metric'revenue''orders''visitors'The trend chart's first metric. default 'revenue' | 'revenue' |
onMetricChange | (metric: Metric) => voidCalled with the metric the trend switch lands on. | – |
today | Date | numberToday, the last day the picker offers. Default: the browser's today once mounted (a fixed demo day before, so hydration matches). | – |
minDate | DateThe first day the picker offers. default the demo store's launch, Jan 6, 2025 | the demo store's launch, Jan 6, 2025 |
currency | stringThe currency of every amount. default 'USD' | 'USD' |
locale | stringFormats dates and numbers. Default: the YoujProvider locale. | – |
brand | { name: string; logo?: ReactNode }The store in the standalone header: its name and mark. Default: Fieldnote Supply and a pencil. | – |
actions | ReactNodeBeside the date picker: an export button, a filter. Default: none. | – |
loading | booleanSkeletons in place of the figures while your data loads; the layout holds. default false | false |
error | ReactNodeShown in place of the figures when they fail to load, with a retry button when | – |
onRetry | () => voidRetries loading after an | – |
empty | ReactNodeReplaces the message for a span without visitors or orders. Default: | – |
copy | Partial<AnalyticsOverviewCopy>Any of the page's strings, to rewrite or translate. Default: the demo's English strings. | – |
AnalyticsCategory
| Prop | Type | |
|---|---|---|
keyRequired | string | – |
labelRequired | string | – |
revenueRequired | number | – |
AnalyticsChannel
| Prop | Type | |
|---|---|---|
keyRequired | string | – |
labelRequired | string | – |
revenueRequired | number | – |
AnalyticsKpi
| Prop | Type | |
|---|---|---|
labelRequired | string | – |
valueRequired | (totals: Day) => number | – |
formatRequired | Intl.NumberFormatOptionsMoney formats without a | – |
toneRequired | 'chart-1' | 'chart-2' | 'chart-3' | 'chart-4' | 'chart-5' | – |
bars | booleanDraws bars a bucket (sums and counts); without it a line (rates and averages). | – |
AnalyticsDateSpan
| Prop | Type | |
|---|---|---|
fromRequired | Date | – |
toRequired | Date | – |
AnalyticsDay
| Prop | Type | |
|---|---|---|
visitorsRequired | number | – |
ordersRequired | number | – |
revenueRequired | number | – |
AnalyticsPoint
| Prop | Type | |
|---|---|---|
labelRequired | stringThe axis label: an hour, a day, a week's first day or a month. | – |
visitorsRequired | number | – |
ordersRequired | number | – |
revenueRequired | number | – |
AnalyticsProduct
| Prop | Type | |
|---|---|---|
idRequired | string | – |
nameRequired | string | – |
categoryRequired | stringA category's | – |
revenueRequired | numberRevenue this period, in the block's currency. | – |
unitsRequired | number | – |
previousRequired | numberRevenue in the period before. | – |
trendRequired | number[]Revenue per bucket, for the row's sparkline. | – |
AnalyticsSummary
| Prop | Type | |
|---|---|---|
spanRequired | DateSpan | – |
previousSpanRequired | DateSpan | – |
daysRequired | number | – |
unitRequired | 'hour' | 'day' | 'week' | 'month'How the series is bucketed. | – |
totalsRequired | Day | – |
previousTotalsRequired | Day | – |
seriesRequired | Point[] | – |
previousSeriesRequired | Point[]The previous period, bucketed the same way and aligned by index. | – |
channelsRequired | AnalyticsChannel[]In legend order; each takes the next chart color. | – |
productsRequired | ProductRow[]Ranked by revenue; the top five are listed. | – |
categoriesRequired | AnalyticsCategory[]Ranked by revenue; the first is highlighted. | – |
Strings40 keys for copy
Strings
copy takes any of these keys; the rest keep their defaults. A key whose text holds a value (a count, a name) takes a function.
titlesectionbadgecomparedWithdateRangeannounceloadingemptyemptyDetailretrykpisvsPreviousbyUnitmetricmetricsoverTimeperagainstthisPeriodpreviousPeriodtrendSummaryperiodtrendCaptionchannelsTitlechannelsDescriptionchannelsSummarychannelsrevenueproductsTitleproductsDescriptionproductsTablerankproductunitschangetrendcategoriesTitlecategoriesLeadnoSalescategoriesLabelAccessibilitylandmarks, headings, loading
Accessibility
Each screen sits in a main or a labelled region with one page heading (headingLevel changes it), and its panels are labelled regions or sections (aria-labelledby) that set aria-busy while they load. Analytics and Funnel report add visually hidden text for loading, ranks, trends and empty cohort cells. Spend overview states its status in words (on track, or the day it will exceed the limit), names the forecast chart with a text summary, draws the request strip as one image that says how many requests failed, and lists the audit trail and the top spenders as ordered lists. Usage shows budget warnings as alerts and labels its spend-cap slider. Money overview names its balance and cards as regions, hides every amount behind a labeled toggle that reports its state, and reviews a payment in a drawer before it sends. Links and buttons are real a and button elements with the kit’s focus ring.