Charts
Five zero-dependency SVG charts — no Recharts, no D3. All are
data-driven (data + a config map of
{ label, color } per series), token-locked (colors come only
from --vyre-* tokens), and ship gridlines, a hover tooltip, a
click-to-toggle legend, and keyboard-accessible tooltips. Jump to a chart from
the list below or the "On this page" rail.
Which chart should I use?
| Chart | Use it for |
|---|---|
| Line Chart | Trends over time (revenue, signups). Multiple series, smooth curves. |
| Area Chart | Volume / cumulative trends. Like Line but filled; gradient and stacked modes. |
| Bar Chart | Compare categories (sales per region). Grouped or stacked, vertical or horizontal. |
| Pie Chart | Parts of a whole (browser share). Pie or donut. |
| Sparkline | Tiny inline chart for Stat cards and table cells. No axis/legend/tooltip. |
data, a config object mapping each series key to
{ label, color }, and xKey. Grid, legend and
tooltip are boolean props (showGrid / showLegend /
showTooltip). There is no color prop and no
Recharts-style JSX children (<XAxis/>, <Tooltip/>) —
colors live in config as --vyre-* tokens.
Line Chart
Multi-series trends over time. Two series (revenue, users)
defined as config keys; one line per key, colors from
--vyre-* tokens.
import { LineChart, Card, CardBody } from "@usevyre/react";
const data = [
{ month: "Jan", revenue: 18, users: 12 },
{ month: "Feb", revenue: 22, users: 15 },
{ month: "Mar", revenue: 20, users: 17 },
{ month: "Apr", revenue: 28, users: 21 },
{ month: "May", revenue: 34, users: 26 },
{ month: "Jun", revenue: 31, users: 29 },
];
const config = {
revenue: { label: "Revenue", color: "var(--vyre-color-semantic-accent)" },
users: { label: "Users", color: "var(--vyre-color-semantic-teal)" },
};
<Card>
<CardBody>
<LineChart data={data} config={config} xKey="month" curve="smooth" dots />
</CardBody>
</Card> <script setup>
import { LineChart, Card, CardBody } from "@usevyre/vue";
const data = [
{ month: "Jan", revenue: 18, users: 12 },
{ month: "Feb", revenue: 22, users: 15 },
{ month: "Mar", revenue: 20, users: 17 },
{ month: "Apr", revenue: 28, users: 21 },
{ month: "May", revenue: 34, users: 26 },
{ month: "Jun", revenue: 31, users: 29 },
];
const config = {
revenue: { label: "Revenue", color: "var(--vyre-color-semantic-accent)" },
users: { label: "Users", color: "var(--vyre-color-semantic-teal)" },
};
</script>
<template>
<Card>
<CardBody>
<LineChart :data="data" :config="config" x-key="month" curve="smooth" dots />
</CardBody>
</Card>
</template> Props
| Prop | Type | Default | Description |
|---|---|---|---|
data * | ChartDatum[] | — | Array of row objects (required), e.g. [{ month: "Jan", revenue: 10 }]. |
config * | ChartConfig | — | Per-series settings (required): { seriesKey: { label, color } }. Colors are token strings; one line per key. |
xKey * | string | — | Field in each row used for the x-axis (required), e.g. "month". |
curve | "linear" | "smooth" | "linear" | Line interpolation. |
dots | boolean | false | Draw a dot at each data point. |
width | number | 480 | SVG width in px. |
height | number | 240 | SVG height in px. |
showGrid | boolean | true | Show background grid lines and axis labels. |
showLegend | boolean | true | Show the legend; clicking a legend item toggles that series. |
showTooltip | boolean | true | Show the hover/arrow-key tooltip. |
Area Chart
Filled trends (line + area). Supports a fade-to-transparent gradient
(default) and stacked series.
import { AreaChart, Card, CardBody } from "@usevyre/react";
const data = [
{ month: "Jan", revenue: 18, users: 12 },
{ month: "Feb", revenue: 22, users: 15 },
{ month: "Mar", revenue: 20, users: 17 },
{ month: "Apr", revenue: 28, users: 21 },
{ month: "May", revenue: 34, users: 26 },
{ month: "Jun", revenue: 31, users: 29 },
];
const config = {
revenue: { label: "Revenue", color: "var(--vyre-color-semantic-accent)" },
users: { label: "Users", color: "var(--vyre-color-semantic-teal)" },
};
<Card>
<CardBody>
<AreaChart data={data} config={config} xKey="month" curve="smooth" stacked />
</CardBody>
</Card> <script setup>
import { AreaChart, Card, CardBody } from "@usevyre/vue";
const data = [
{ month: "Jan", revenue: 18, users: 12 },
{ month: "Feb", revenue: 22, users: 15 },
{ month: "Mar", revenue: 20, users: 17 },
{ month: "Apr", revenue: 28, users: 21 },
{ month: "May", revenue: 34, users: 26 },
{ month: "Jun", revenue: 31, users: 29 },
];
const config = {
revenue: { label: "Revenue", color: "var(--vyre-color-semantic-accent)" },
users: { label: "Users", color: "var(--vyre-color-semantic-teal)" },
};
</script>
<template>
<Card>
<CardBody>
<AreaChart :data="data" :config="config" x-key="month" curve="smooth" stacked />
</CardBody>
</Card>
</template> Props
| Prop | Type | Default | Description |
|---|---|---|---|
data * | ChartDatum[] | — | Array of row objects (required). |
config * | ChartConfig | — | Per-series settings (required): { seriesKey: { label, color } }. Colors are token strings. |
xKey * | string | — | Field in each row used for the x-axis (required). |
curve | "linear" | "smooth" | "linear" | Line/area interpolation. |
gradient | boolean | true | Fill each area with a fade-to-transparent gradient (false = flat low-opacity fill). |
stacked | boolean | false | Stack series on top of each other instead of overlaying. |
width | number | 480 | SVG width in px. |
height | number | 240 | SVG height in px. |
showGrid | boolean | true | Show background grid lines and axis labels. |
showLegend | boolean | true | Show the legend; clicking a legend item toggles that series. |
showTooltip | boolean | true | Show the hover/arrow-key tooltip. |
Bar Chart
Category comparison. Multiple series render as grouped side-by-side bars or
stacked; supports vertical and horizontal
orientation.
import { BarChart, Card, CardBody } from "@usevyre/react";
const data = [
{ region: "NA", sales: 38, returns: 6 },
{ region: "EU", sales: 31, returns: 5 },
{ region: "APAC", sales: 27, returns: 4 },
{ region: "LATAM", sales: 14, returns: 3 },
];
const config = {
sales: { label: "Sales", color: "var(--vyre-color-semantic-accent)" },
returns: { label: "Returns", color: "var(--vyre-color-semantic-warning)" },
};
<Card>
<CardBody>
<BarChart data={data} config={config} xKey="region" />
</CardBody>
</Card> <script setup>
import { BarChart, Card, CardBody } from "@usevyre/vue";
const data = [
{ region: "NA", sales: 38, returns: 6 },
{ region: "EU", sales: 31, returns: 5 },
{ region: "APAC", sales: 27, returns: 4 },
{ region: "LATAM", sales: 14, returns: 3 },
];
const config = {
sales: { label: "Sales", color: "var(--vyre-color-semantic-accent)" },
returns: { label: "Returns", color: "var(--vyre-color-semantic-warning)" },
};
</script>
<template>
<Card>
<CardBody>
<BarChart :data="data" :config="config" x-key="region" />
</CardBody>
</Card>
</template> Props
| Prop | Type | Default | Description |
|---|---|---|---|
data * | ChartDatum[] | — | Array of row objects (required), e.g. [{ region: "NA", sales: 30 }]. |
config * | ChartConfig | — | Per-series settings (required): { seriesKey: { label, color } }. One bar group per datum. |
xKey * | string | — | Field in each row used for the category axis (required). |
orientation | "vertical" | "horizontal" | "vertical" | Bar direction. |
stacked | boolean | false | Stack series per category instead of grouping them side-by-side. |
width | number | 480 | SVG width in px. |
height | number | 240 | SVG height in px. |
showGrid | boolean | true | Show background grid lines and axis labels. |
showLegend | boolean | true | Show the legend; clicking a legend item toggles that series. |
showTooltip | boolean | true | Show the hover/arrow-key tooltip. |
Pie Chart
Parts of a whole. Takes flat { name, value }
data (not multi-series rows, not numbers). config is optional;
unmatched names use a built-in token color cycle. Set donut for a
hollow center.
import { PieChart, Card, CardBody } from "@usevyre/react";
const data = [
{ name: "Chrome", value: 62 },
{ name: "Safari", value: 19 },
{ name: "Firefox", value: 9 },
{ name: "Edge", value: 7 },
{ name: "Other", value: 3 },
];
const config = {
Chrome: { label: "Chrome", color: "var(--vyre-color-semantic-accent)" },
Safari: { label: "Safari", color: "var(--vyre-color-semantic-teal)" },
Firefox: { label: "Firefox", color: "var(--vyre-color-semantic-warning)" },
Edge: { label: "Edge", color: "var(--vyre-color-semantic-success)" },
Other: { label: "Other", color: "var(--vyre-color-semantic-danger)" },
};
<Card>
<CardBody>
<PieChart data={data} config={config} donut />
</CardBody>
</Card> <script setup>
import { PieChart, Card, CardBody } from "@usevyre/vue";
const data = [
{ name: "Chrome", value: 62 },
{ name: "Safari", value: 19 },
{ name: "Firefox", value: 9 },
{ name: "Edge", value: 7 },
{ name: "Other", value: 3 },
];
const config = {
Chrome: { label: "Chrome", color: "var(--vyre-color-semantic-accent)" },
Safari: { label: "Safari", color: "var(--vyre-color-semantic-teal)" },
Firefox: { label: "Firefox", color: "var(--vyre-color-semantic-warning)" },
Edge: { label: "Edge", color: "var(--vyre-color-semantic-success)" },
Other: { label: "Other", color: "var(--vyre-color-semantic-danger)" },
};
</script>
<template>
<Card>
<CardBody>
<PieChart :data="data" :config="config" donut />
</CardBody>
</Card>
</template> Props
| Prop | Type | Default | Description |
|---|---|---|---|
data * | PieDatum[] | — | Flat array of { name: string; value: number } objects (required). |
config | ChartConfig | — | Optional per-segment settings: { name: { label, color } }. Unmatched names use a token color cycle. |
donut | boolean | false | Render a hollow-center donut instead of a full pie. |
size | number | 240 | SVG width AND height in px (the chart is square). |
showLegend | boolean | true | Show the legend; clicking a legend item toggles that segment. |
showTooltip | boolean | true | Show the hover tooltip. |
Sparkline
A tiny inline chart — no axis, legend, or tooltip — for Stat cards and table
cells. Takes a flat number[] and a variant.
import { Sparkline, Stat, Card, CardBody } from "@usevyre/react";
<Card>
<CardBody>
<Stat
label="Revenue"
value="$48.2k"
delta="+12%"
trend="up"
deltaLabel="last 8 months"
icon={
<Sparkline
data={[18, 22, 20, 28, 34, 31, 40, 46]}
color="var(--vyre-color-semantic-success)"
width={96}
height={28}
/>
}
/>
</CardBody>
</Card> <script setup>
import { Sparkline, Stat, Card, CardBody } from "@usevyre/vue";
</script>
<template>
<Card>
<CardBody>
<Stat label="Revenue" value="$48.2k" delta="+12%" trend="up" delta-label="last 8 months">
<template #icon>
<Sparkline
:data="[18, 22, 20, 28, 34, 31, 40, 46]"
color="var(--vyre-color-semantic-success)"
:width="96"
:height="28"
/>
</template>
</Stat>
</CardBody>
</Card>
</template> Three variants: line, area, bar.
import { Sparkline } from "@usevyre/react";
<Sparkline data={[3, 7, 4, 9, 6, 11, 8]} variant="line" />
<Sparkline data={[3, 7, 4, 9, 6, 11, 8]} variant="area" />
<Sparkline data={[3, 7, 4, 9, 6, 11, 8]} variant="bar" /> <script setup>
import { Sparkline } from "@usevyre/vue";
</script>
<template>
<Sparkline :data="[3, 7, 4, 9, 6, 11, 8]" variant="line" />
<Sparkline :data="[3, 7, 4, 9, 6, 11, 8]" variant="area" />
<Sparkline :data="[3, 7, 4, 9, 6, 11, 8]" variant="bar" />
</template> Props
| Prop | Type | Default | Description |
|---|---|---|---|
data * | number[] | — | Series of numbers to plot (required). A flat array of numbers, not row objects. |
variant | "line" | "area" | "bar" | "line" | Render style of the sparkline. |
color | string | var(--vyre-color-semantic-accent) | Stroke/fill color as a token string. |
width | number | 80 | SVG width in px. |
height | number | 24 | SVG height in px. |
AI Context
Copy-paste context per chart for Claude, Cursor, Copilot, Windsurf, and Gemini. Each block is labelled with its component.
LineChart
Valid props
| Prop | Values | Default |
|---|---|---|
curve | "linear"|"smooth" | linear |
dots | true|false | false |
showGrid | true|false | true |
showLegend | true|false | true |
showTooltip | true|false | true |
Common AI mistakes
- Passing series via series={...}→ Use data (row objects) + config ({ key: { label, color } }) + xKey
- Setting a single color with color="blue"→ config={{ revenue: { label: "Revenue", color: "var(--vyre-color-semantic-accent)" } }}
- Recharts-style children like <XAxis/> or <Tooltip/>→ Use showGrid / showLegend / showTooltip props instead of child elements
Quick examples
<LineChart
data={[{ month: "Jan", revenue: 10 }, { month: "Feb", revenue: 20 }]}
config={{ revenue: { label: "Revenue", color: "var(--vyre-color-semantic-accent)" } }}
xKey="month"
/><LineChart data={data} config={config} xKey="month" curve="smooth" dots showLegend={false} />AreaChart
Valid props
| Prop | Values | Default |
|---|---|---|
curve | "linear"|"smooth" | linear |
gradient | true|false | true |
stacked | true|false | false |
showGrid | true|false | true |
showLegend | true|false | true |
showTooltip | true|false | true |
Common AI mistakes
- Passing series via series={...}→ Use data (row objects) + config ({ key: { label, color } }) + xKey
- Setting a single color with color="blue"→ config={{ revenue: { label: "Revenue", color: "var(--vyre-color-semantic-accent)" } }}
- Recharts-style children like <XAxis/> or <Tooltip/>→ Use showGrid / showLegend / showTooltip props instead of child elements
Quick examples
<AreaChart
data={[{ month: "Jan", revenue: 10 }, { month: "Feb", revenue: 20 }]}
config={{ revenue: { label: "Revenue", color: "var(--vyre-color-semantic-accent)" } }}
xKey="month"
/><AreaChart data={data} config={config} xKey="month" stacked gradient={false} />BarChart
Valid props
| Prop | Values | Default |
|---|---|---|
orientation | "vertical"|"horizontal" | vertical |
stacked | true|false | false |
showGrid | true|false | true |
showLegend | true|false | true |
showTooltip | true|false | true |
Common AI mistakes
- Passing series via series={...}→ Use data (row objects) + config ({ key: { label, color } }) + xKey
- Setting a single color with color="blue"→ config={{ sales: { label: "Sales", color: "var(--vyre-color-semantic-accent)" } }}
- Recharts-style children like <XAxis/> or <Tooltip/>→ Use showGrid / showLegend / showTooltip props instead of child elements
Quick examples
<BarChart
data={[{ region: "NA", sales: 30 }, { region: "EU", sales: 25 }]}
config={{ sales: { label: "Sales", color: "var(--vyre-color-semantic-accent)" } }}
xKey="region"
/><BarChart data={data} config={config} xKey="region" orientation="horizontal" stacked />PieChart
Valid props
| Prop | Values | Default |
|---|---|---|
donut | true|false | false |
showLegend | true|false | true |
showTooltip | true|false | true |
Common AI mistakes
- Passing numbers: data={[1, 2, 3]}→ data={[{ name: "Chrome", value: 60 }, { name: "Safari", value: 25 }]}
- Setting a single color with color="blue"→ Omit color (auto token cycle) or config={{ Chrome: { label: "Chrome", color: "var(--vyre-color-semantic-accent)" } }}
- Recharts-style <Pie>/<Cell> children→ Use the data prop (and donut for a ring) instead of child elements
Quick examples
<PieChart
data={[
{ name: "Chrome", value: 60 },
{ name: "Safari", value: 25 },
{ name: "Firefox", value: 15 },
]}
donut
/><PieChart
data={[{ name: "Chrome", value: 60 }, { name: "Safari", value: 40 }]}
config={{ Chrome: { label: "Chrome", color: "var(--vyre-color-semantic-accent)" } }}
/>Sparkline
Valid props
| Prop | Values | Default |
|---|---|---|
variant | "line"|"area"|"bar" | line |
Common AI mistakes
- Passing row objects: data={[{ name, value }]}→ data={[3, 7, 4, 9, 6]}
- Expecting an axis, legend or tooltip→ Use LineChart/AreaChart/BarChart for a full chart with axes and tooltip
Quick examples
<Sparkline data={[3, 7, 4, 9, 6, 11]} /><Sparkline data={[2, 4, 3, 8]} variant="bar" color="var(--vyre-color-semantic-success)" />