Zephora UI

Other

Chart

Dependency-free static SVG chart: line, area, bar, pie, donut, mixed (per-dataset marks), radar, scatter and heatmap. Accepts labels plus one or more datasets, colors series from the token palette and titles every point for hover tooltips.

Import

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

Examples

Line and area

Line chart of Revenue, CostsJan — Revenue: 12Feb — Revenue: 19Mar — Revenue: 14Apr — Revenue: 25May — Revenue: 22Jun — Revenue: 30Jan — Costs: 8Feb — Costs: 11Mar — Costs: 10Apr — Costs: 14May — Costs: 12Jun — Costs: 16
  • Revenue
  • Costs
Area chart of Revenue, Costs

Bar

Multiple datasets render as grouped bars per label.

Bar chart of 2024, 2025Q1 — 2024: 40Q1 — 2025: 52Q2 — 2024: 55Q2 — 2025: 61Q3 — 2024: 48Q3 — 2025: 66Q4 — 2024: 70Q4 — 2025: 84
  • 2024
  • 2025

Pie and donut

Radial charts read the first dataset and use one slice per label.

Pie chart of ShareChrome: 62Safari: 20Firefox: 10Edge: 8
  • Chrome
  • Safari
  • Firefox
  • Edge
Donut chart of ShareChrome: 62Safari: 20Firefox: 10Edge: 8
  • Chrome
  • Safari
  • Firefox
  • Edge

Mixed

`type="mixed"` lets every dataset pick its own mark via `kind` (default "bar"): bars split the group width between the bar datasets while line/area points sit at the middle of each label group so they align with the bars.

Mixed chart of Revenue, Costs, Margin %Q1 — Revenue: 40Q1 — Costs: 26Q2 — Revenue: 55Q2 — Costs: 30Q3 — Revenue: 48Q3 — Costs: 28Q4 — Revenue: 70Q4 — Costs: 38Q1 — Margin %: 35Q2 — Margin %: 45Q3 — Margin %: 42Q4 — Margin %: 46
  • Revenue
  • Costs
  • Margin %

Mixed dual axis

`yAxis="right"` (mixed only) scales a dataset against its own max instead of the shared left max — the right max is printed at the right edge. Ideal when a percentage series would otherwise flatten against large absolute values.

Mixed chart of Revenue, Conversion %Q1 — Revenue: 400Q2 — Revenue: 550Q3 — Revenue: 480Q4 — Revenue: 700Q1 — Conversion %: 2.4Q2 — Conversion %: 3.1Q3 — Conversion %: 2.8Q4 — Conversion %: 3.63.6
  • Revenue
  • Conversion %

Radar

Each label becomes a spoke; every dataset draws a translucent polygon over the shared ring grid — ideal for comparing profiles across the same set of axes.

Radar chart of Ada, KaiSpeedPowerRangeDefenseStaminaAdaKai
  • Ada
  • Kai

Scatter

Scatter datasets take explicit `{ x, y }` points (`ScatterPoint`); the x scale spans the min/max of all points. Plain numbers fall back to their index as x.

Scatter chart of Sample A, Sample BSample A: (4, 12)Sample A: (9, 30)Sample A: (15, 22)Sample A: (21, 45)Sample A: (28, 38)Sample A: (34, 52)Sample B: (6, 8)Sample B: (12, 18)Sample B: (18, 14)Sample B: (24, 26)Sample B: (30, 21)Sample B: (36, 33)
  • Sample A
  • Sample B

Heatmap

Datasets are rows (the dataset label becomes the row label), labels are columns. Cell values map onto a five-step light-to-dark ramp of the primary token color; row/column labels render on the plot, so the legend is omitted.

Heatmap chart of Morning, Afternoon, EveningMorning, Mon: 2Morning, Tue: 5Morning, Wed: 3Morning, Thu: 8Morning, Fri: 6Morning, Sat: 1Morning, Sun: 0Afternoon, Mon: 6Afternoon, Tue: 9Afternoon, Wed: 7Afternoon, Thu: 12Afternoon, Fri: 10Afternoon, Sat: 4Afternoon, Sun: 2Evening, Mon: 4Evening, Tue: 7Evening, Wed: 11Evening, Thu: 9Evening, Fri: 14Evening, Sat: 8Evening, Sun: 5MorningAfternoonEveningMonTueWedThuFriSatSun

API

Chart props

PropTypeDefaultDescription
type *"line" | "area" | "bar" | "pie" | "donut" | "mixed" | "radar" | "scatter" | "heatmap"Chart shape. "mixed" reads each dataset's `kind` for its mark.
data *{ labels: string[]; datasets: ChartDataset[] }Labels plus one or more datasets. Pie/donut read the first dataset.
widthnumber480SVG width in px.
heightnumber240SVG height in px.
showLegendbooleantrueRenders a legend under the chart.
showGridbooleantrueHorizontal gridlines (line/area/bar only).
strokeWidthnumber2Line thickness for line/area charts.
aria-labelstringAccessible chart summary; auto-generated from the type and dataset labels.
unstyledbooleanfalseHeadless mode — skips Zephora styling.

ChartDataset props

PropTypeDefaultDescription
label *stringSeries name shown in the legend and point tooltips.
data *number[] | ScatterPoint[]Series values. Scatter reads `{x, y}` points (plain numbers fall back to their index as x); every other type reads numbers (points read their y).
colorstringSeries color. Defaults to the token palette by dataset index.
kind"bar" | "line" | "area""bar"Per-dataset mark used by type="mixed"; ignored by the other chart types.
yAxis"left" | "right""left"Scale used by type="mixed": "right" datasets scale against their own max (shown at the right edge) instead of the shared left max.

ScatterPoint props

PropTypeDefaultDescription
x *numberHorizontal position; the x scale spans the min/max across all points.
y *numberVertical value, scaled against the max across all datasets.