Skip to content

Sparkline

A word-sized line, area or bar run that sits on the text baseline with its latest value beside it, the newest point a hot dot and the low and high marked by 3px ticks.

$149 once · every Pro piece

Customize

Point, drag a finger or use the arrow keys: a marker springs to the nearest point and the value rolls to it. Two hover treatments: everything after the marker steps back, or the local segment (the whole line drops to half and only the stretch round the cursor stays bright). Types: line, area with a gradient or a solid fill, step, bars and negative bars. Crosshair styles, three hover feels (spring, snappy, none), dashed average or median hairlines, a threshold past which it runs hot, a dashed ghost of the previous period with the change beside the value, and rows or KPI cards that scrub together through one shared store. Built for tables and dense grids: one page-wide observer, one path per series, no loops at rest.

Install

npx shadcn@latest add @obsyde/sparkline

Needs your licence key · Get Pro

Usage

Import it from where the CLI puts it, or copy the files below by hand.

import { Sparkline } from '@/components/obsyde/ember/sparkline/Sparkline';

export function Example() {
  return (
    <Sparkline type="line" />
  );
}

Files

What you get with Pro: plain React, TypeScript and CSS, with no dependencies.

  • ember/sparkline/Sparkline.tsxcomponent
  • ember/sparkline/sparkline.cssstyles
  • ember/sparkline/sparkline-demo.cssstyles
  • ember/sparkline/SparklineDemo.tsxdemo
  • ember/viz-kit/viz-kit.cssshared
  • ember/viz-kit/Tooltip.tsxshared
  • ember/viz-kit/focus.tsshared
  • ember/viz-kit/patterns.tsxshared
  • ember/viz-kit/roll.tsshared
  • ember/shared/rolling-number.cssshared
  • ember/shared/spring.tsshared
  • ember/shared/accent.tsshared
  • ember/viz-kit/scale.tsshared
  • ember/viz-kit/motion.tsshared
  • ember/viz-kit/chart.tsxshared
  • ember/shared/ember.cssshared
  • ember/viz-kit/touch.tsshared
  • ember/viz-kit/keyboard.tsshared
  • ember/viz-kit/size.tsshared
  • ember/viz-kit/States.tsxshared
  • ember/viz-kit/shape.tsshared
  • ember/viz-kit/series.tsxshared
  • ember/viz-kit/demo.tsxshared
  • ember/viz-kit/demo.cssshared
  • ember/viz-kit/annotations.tsxshared

API

PropTypeDefault
accentAccent'ember' | 'volt' | 'arc''ember'
viewView'rows' | 'kpi' | 'variants' | 'crosshairs' | 'feel' | 'table' | 'grid''rows'
typeType'line' | 'area' | 'area-solid' | 'step' | 'bars''line'
highlightHover'after' | 'segment' | 'none''after'
feelFeel'spring' | 'snappy' | 'none''spring'
endDotEnd dotbooleantrue
syncSync rowsbooleanfalse
widthWidthnumber96
heightHeightnumber24
showValueShow valuebooleantrue
unitUnitstring—
refLinesReference lines'none' | 'avg' | 'median' | 'min-max' | 'all''none'
thresholdThreshold'none' | 'above' | 'below''none'
thresholdValueThreshold valuenumber60
compareComparebooleanfalse
crosshairCrosshair'none' | 'solid' | 'dashed' | 'gradient''none'
curveCurve'monotone' | 'linear' | 'catmull''monotone'
revealReveal'sweep' | 'cool' | 'rise' | 'fade' | 'none''sweep'
statusStatus'ready' | 'loading' | 'empty''ready'
liveLivebooleanfalse
pointsPointsnumber32
seedSeednumber1