DDS/Components/Sparkline

Sparkline

Charts

A minimal inline chart for KPI cards, tables, and dashboards. Supports line and bar types.

Props

PropTypeDefaultDescription
data*number[]Array of numeric values.
type"line" | "bar""line"Chart type.
colorstring"#7f00ff"Stroke/fill color.
showAreabooleantrueFill area under line.
widthnumber100Width in pixels.
heightnumber36Height in pixels.
showValuebooleanfalseShow last value as text.
trendColorbooleanfalseAuto-color: green if up, red if down.

Examples

In a KPI card

Revenue

+12.4%

$10,200

Users

+8.1%

4,821

Churn

-0.4%

2.3%

vue
<!-- Line sparkline (for KPI cards) -->
<DsSparkline
  :data="[12, 18, 14, 22, 19, 28, 25, 31]"
  type="line"
  color="#7f00ff"
  :show-area="true"
  :width="100"
  :height="36"
/>

<!-- Bar sparkline with trend color -->
<DsSparkline
  :data="[8, 14, 11, 6, 9, 13, 17]"
  type="bar"
  :trend-color="true"
  :width="80"
  :height="32"
  :show-value="true"
/>
Bar sparkline
Weekly
22
Trend
vue
<!-- Line sparkline (for KPI cards) -->
<DsSparkline
  :data="[12, 18, 14, 22, 19, 28, 25, 31]"
  type="line"
  color="#7f00ff"
  :show-area="true"
  :width="100"
  :height="36"
/>

<!-- Bar sparkline with trend color -->
<DsSparkline
  :data="[8, 14, 11, 6, 9, 13, 17]"
  type="bar"
  :trend-color="true"
  :width="80"
  :height="32"
  :show-value="true"
/>

Skeleton

Use DsSparklineSkeleton as a loading placeholder while content is being fetched.

Default
vue
<DsSparklineSkeleton
  :width="100"
  :height="36"
/>
With value
vue
<DsSparklineSkeleton
  :width="100"
  :height="36"
  showValue
/>

Accessibility

  • Decorative SVG — add aria-hidden="true" when used purely for visual trend.