Spotlight Stat Card

Pro

Dark-first KPI card with a gradient hairline border, ambient accent glow, gradient icon token and an inline gradient sparkline.

</>sv-spotlight-stat-card kpimetricpremiumdashboardsparklinegradient

Complexity tier: Primitive Presents a value: held to semantic markup and contrast, laid out with logical properties so it mirrors under right-to-left, and with what it does on paper decided.

import { SvSpotlightStatCardComponent } from '@styloviz-pro/stat-card';

Demo & usage

Basic usage

Pro

Usage example — open the gallery for the full interactive demo.

Pro

An interactive demo for this component lives in the gallery.

Open live demo

More examples

Accent colors

Pro

Six built-in accent themes drive the border, glow, icon and sparkline gradient.

Downward trend

Pro

A down trend renders a rose chip with a descending arrow.

When to use

  • Dark-themed dashboards where the standard Stat Card looks flat.
  • A hero KPI row that needs gradient accents and an inline trend sparkline.
  • Marketing or product pages where the KPI is the focal element.

Async states

  • loading
  • error
  • retry

Inputs

NameTypeDefaultDescription
loadingbooleanfalseTrue while the figure is being fetched.
errorSvDataError | string | nullnullThe figure could not be loaded. Replaces the number, so the tile never shows a stale one as current. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
titlestring''Metric label.
valuestring | number''Primary value (already formatted, e.g. "1.24M" or "42.3").
prefixstring''Text rendered before the value (e.g. "$").
suffixstring''Text rendered after the value (e.g. "%").
trendStatCardTrend'neutral'Trend direction — drives the chip color and arrow.
trendPercentnumber | nullnullPercentage change shown in the trend chip.
trendLabelstring''Caption next to the trend chip (e.g. "vs last month") — the comparison period. Also read into the chip's accessible name; where it is missing the name says "comparison period not stated" rather than a bare percentage.
updatedAtstring''When this figure was last refreshed, as `YYYY-MM-DD` or an ISO timestamp. Renders an "Updated … ago" line, as on `sv-stat-card-pro`. A cached KPI looks identical to a live one — and this is the card built to be the loudest figure on the page.
staleAfterMinutesnumber60How many minutes before the figure is called out as possibly stale.
sourcestring''Where the figure came from — a warehouse, a job, a service.
accentSpotlightAccent'violet'Accent color theme.
iconstring''Name of an icon in `@styloviz/icons` (was a raw 24×24 SVG path).
sparklineSparkPoint[][]Sparkline points; rendered as a gradient area behind the value.
trendPolarityStatCardTrendPolarity'up-is-good'Which direction of `trend` is good news — see `StatCardTrendPolarity`.
sparklineDomainreadonly [number, number] | nullnull`[min, max]` for the sparkline, shared across a KPI row so the lines are drawn on one scale — see `sv-stat-card-pro`'s `sparklineDomain`.
customClassstring''Extra classes for the root element.

Outputs

EventPayload typeDescription
retryvoidThe host should re-run the failed load.

Customization & theming

  • Takes the family's `trendPolarity` and `sparklineDomain`, and abbreviates numbers with the same `svFormatCompact` rule as the free and Pro cards.
  • Six accents: violet, cyan, emerald, amber, rose, blue.
  • Gradient border, glow, icon token and sparkline all derive from the accent.
  • Pass `sparkline` points to render the inline gradient area; omit it to hide the chart.
  • Name any glyph from the icon library with `icon`.

Best practices

  • Do: Pre-format the `value` (e.g. `1.24M`, `$847K`) before binding.
  • Do: Map each metric to a distinct `accent` so a KPI row reads at a glance.
  • Don't: Don't place it on a busy multicolor background — use it on dark or neutral backgrounds.

Accessibility

  • Value, trend and label are real text, not images.
  • The sparkline is decorative and hidden from assistive tech (`aria-hidden`).
  • Each instance gets a unique gradient id so multiple cards never collide.
  • Trend chip color is reinforced with a directional arrow, not color alone.

Feedback on Spotlight Stat Card

Spotted a gap in this page, or something that didn't work as described? Comments are GitHub Discussions in the public styloviz/community repo, so posting needs a GitHub account.

Loads giscus.app and GitHub — nothing is fetched until you click.