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 / Charts

Sparkline

Tiny trend line with no axes, for tables and stat tiles (MUI X's SparkLineChart).

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

Example

Code
import { Sparkline, Stack, Text, TrendUpIcon } from "@stylhero/ui";

function SparklineExample() {
  return (
    <Stack direction="row" gap={3} align="center">
      <Text>Sales</Text>
      <Sparkline label="Sales, last 7 days: rising" data={[3, 5, 4, 6, 8, 7, 10]} />
      <TrendUpIcon />
    </Stack>
  );
}

Props

PropTypeDefaultDescription
data required number[] -
label required string - Accessible summary, e.g. "Visits, last 14 days, up 12%".
area boolean true
height number 32
width number 120

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

Accessibility

  • role="img"; label is required, e.g. "Sales, last 7 days: rising".

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