Skip to content
Stylhero 0.8.0
Components

Core

Layout and type

Inputs

Overlays

Navigation

Data display

Charts

Transitions and utilities

Page pieces (landing pages, portfolios, docs)

Icons

Components / Data display

Stat

A headline number for dashboards.

import { Stat } from "@stylhero/ui";

Example

Code
import { Grid, Stat } from "@stylhero/ui";

function StatExample() {
  return (
    <Grid minChildWidth={180} gap={4}>
      <Stat label="Builds this week" value="1,284" change="+12%" trend="up" />
      <Stat label="Average price" value="$1,140" change="-3%" trend="down" hint="vs. last week" />
      <Stat label="Returns" value="0.8%" change="+0.2%" trend="up" invert />
    </Grid>
  );
}

Props

PropTypeDefaultDescription
label required ReactNode -
value required ReactNode -
change string - e.g. "+12%". Its sign picks the arrow unless trend is set.
hint ReactNode -
invert boolean - Set when going down is good (e.g. wait time), so down shows green.
trend "up" | "down" -
valueFirst boolean - Number above the label, for labels that continue the number ("3 · checks per answer").

Also takes every <div> attribute (id, style, data-*, aria-*, event handlers…), passed to that element.

Generated from src/components/Stat.tsx. Something wrong or missing? Open an issue.