Server Component · 0 KB client JS

Stat

A single metric with label, value, help text and a trend indicator.

Total users24,52112.4% from last month
Bounce rate18.2%3.1% from last month

Import#

import { Stat } from "astralis-ui";
// Stat.Label, .Value, .HelpText, .Indicator

Usage#

Values render with tabular numerals so dashboards line up; the indicator colors green for increase and red for decrease. Note that "decrease" is just the arrow direction, not a judgment (a falling bounce rate is good news).

Size#

size scales the label, value and help text together, so a resized Stat stays in proportion instead of growing one line and leaving the others behind. It is responsive, which is what lets one Stat serve a dense dashboard tile and a marketing band.

Monthly revenue · sm$48,2008.1% from last month
Monthly revenue · md$48,2008.1% from last month
Monthly revenue · lg$48,2008.1% from last month
Monthly revenue · xl$48,2008.1% from last month
{/* big on desktop, back in its box on a two-up mobile grid */}
<Stat size={{ base: "lg", lg: "xl" }} align="center">
  <Stat.Value>99.9%</Stat.Value>
  <Stat.Label>Uptime</Stat.Label>
</Stat>

Children render in the order you write them, so a marketing band can lead with the value while a dashboard tile leads with the label.

Props#

PropTypeDefaultDescription
size"sm" | "md" | "lg" | "xl""md"Scales label, value and help text together. md suits dashboards, xl marketing bands. Responsive.
align"start" | "center" | "end""start"How the lines align within the stat. Responsive.

Parts#

PropTypeDefaultDescription
Stat.Label / Value / HelpTextspan propsNoneThe three lines. Each takes its size from the root.
Stat.Indicatortype?: "increase" | "decrease"NoneTrend arrow inside the help text, colored for the direction.

Compose Stats in a Grid or HStack for dashboard rows, and inside a Card for tiles.