Skip to main content
161

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Web docs
Data display

Sparkline

Shows a compact, text-labelled trend beside an existing metric.

FrameworksAstro · React · Elements

Registry commandlumen add Sparkline

InteractionNative markup

01

See it and copy it

Framework example

Choose Astro, React, or Elements to compare native usage against the shared visual output. Each example assumes the framework-level setup is already complete.

AstroSame visual contract, native framework API
Downloads
18,420
Downloads increased from 42 to 91

Framework usage

Switch targets to compare the adapter code. The preview stays visually stable because all three packages share the same tokens and ui-* class contract.
astro
---
import { Sparkline, Stat } from '@santi020k/lumen-astro'
---

<div style="display: flex; align-items: end; justify-content: space-between; gap: 1rem">
  <Stat label="Downloads" value="18,420" />
  <Sparkline
    area
    label="Downloads increased from 42 to 91"
    values={[42, 48, 63, 58, 74, 91]}
  />
</div>
Edit Sparkline in browser
02

Choose your target

Add this component

Choose the package for your runtime. All adapters share the Lumen stylesheet. Use the matching registry command when you want a local wrapper for that framework.

bash@santi020k/lumen-astro
pnpm add @santi020k/lumen-astro
pnpm add @santi020k/lumen-astro
bashAstro wrapper
lumen add Sparkline
lumen add Sparkline

API reference

Lumen-specific props and runtime attributes for the Astro primitive. React props follow the same names; Elements use equivalent kebab-case attributes where custom elements expose them.

AttributeValuesDefaultDescription
valuesnumber[]requiredProvides ordered values for the compact trend.
labelstringrequiredCommunicates the trend in text because the SVG is intentionally decorative.
areabooleanfalseAdds a subtle tokenized fill below the line.
showEndpointbooleantrueMarks the latest value with a color-independent endpoint.
toneLumenChartTone"series-1"Selects a categorical or explicitly semantic chart tone.
class, classNamestring""Merges custom classes with the generated ui-* root classes.
...native attributesHTML attributes-Forwards standard attributes to the root element unless the component consumes them.

Web docsFull catalog