Zephora UI

Other

Sparkline

Word-sized, axis-free trend chart rendered inline with text — ideal for table cells and stat tiles. Values are normalized against the true min/max of the series (the baseline is not pinned to zero); a flat series renders as a midline.

Import

import { Sparkline } from "@zephora/react";

Examples

Variants

Three mark shapes: `line` (with a dot on the final value), `area` and `bar`.

min 4, max 14, last 14min 4, max 14, last 14min 4, max 14, last 14

In a table cell

The component renders as an inline `<span>`, so it drops straight into table cells for mini trend columns.

ZPHmin 12, max 21, last 21+8.2%
ACMEmin 22, max 30, last 22-5.1%
INITmin 8, max 12, last 12+3.4%

Sizing and stroke

`width`/`height` set the SVG box; `strokeWidth` tunes the line weight and `showLastPoint={false}` drops the final-value dot.

min 3, max 15, last 12min 3, max 15, last 12

API

Sparkline props

PropTypeDefaultDescription
data *number[]Series values, rendered left to right.
variant"line" | "area" | "bar""line"Mark shape.
widthnumber100SVG width in px.
heightnumber24SVG height in px.
colorstringMark color. Defaults to the primary token.
showLastPointbooleantrueEmphasizes the final value with a dot (line variant only).
strokeWidthnumber1.5Line thickness for line/area variants.
aria-labelstring"sparkline"Accessible name of the chart; the SVG title also announces min, max and last values.
unstyledbooleanfalseHeadless mode — skips Zephora styling.
…restHTMLAttributes<HTMLSpanElement>All native span props are forwarded to the inline wrapper.