Sparkline
Server ComponentTiny inline line, area, or bar trend chart for stat tiles.
Import
tsx
import { Sparkline } from "@cronus-ui/ui";
bash
npx cronus-ui add sparkline
Examples
.cronus
The same component declared in Cronus. Emitted at build time from the audit fixtures — the kernel renders it as HTML with no React.
default.cronus
app "audit-fixtures" {
port 5176
}
style {
preset aurora
theme dark
}
component SparklineDefault layout:inline style:sparkline {
data:"4,8,6,10,7"
aria-label:"Trend"
label "Trend"
}
page "/audit/sparkline/default" type:custom {
use SparklineDefault
}
API Reference
Generated from the component's exported types.
SparklineProps
Extends Omit<SVGAttributes<SVGSVGElement>, "type">
| Prop | Type | Default | Description |
|---|---|---|---|
data* | number[] | — | The series to plot. Order is preserved; values map left→right. |
width | number | 96 | Intrinsic width of the SVG in px. |
height | number | 28 | Intrinsic height of the SVG in px. |
type | SparklineType | "line" | Render a connected line or evenly spaced bars. |
tone | SparklineTone | "primary" | Color, mapped to a token via `currentColor`. |
area | boolean | false | For `type="line"`, fill a soft token-tinted gradient under the line. |
strokeWidth | number | 1.5 | Stroke width of the line (line type only). |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
viewBox | string | — | — |
aria-hidden | boolean | — | — |