Data

Sparkline.

A compact trend with signed values and explicit missing observations.

LIVE PREVIEWTry it. It works.

Install the source

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/sparkline.json

Registry setup · Examples · API and behavior · Open the playground

COMPLETE EXAMPLES

Use it in context.

Each example includes its imports, data and state. The preview runs that same source. Include the stylesheet once in your application.

A trend that preserves missing observations

A compact metric trend leaves a real gap when an observation is unavailable.

Keyboard

  • Open View data to read every original observation.

States covered

  • missing value
  • signed values
  • constant series
  • exact data

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-chart-sparkline-missing.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import '@bld8/ui/styles.css';
import {Sparkline} from '@bld8/ui';
export default function Trend(){return <Sparkline label="Weekly change" data={[{id:'mon',label:'Monday',value:-4},{id:'tue',label:'Tuesday',value:2},{id:'wed',label:'Wednesday',value:null},{id:'thu',label:'Thursday',value:5},{id:'fri',label:'Friday',value:3}]} format={{maximumFractionDigits:1}}/>;}

Quick reference

React / TypeScript
<Sparkline label="Weekly change" data={observations} />

In the workspace or ZIP starter, import components from @bld8/ui and include @bld8/ui/styles.css once. Registry installations use your local bld8/ source path. Wrap overlays in UIProvider.

API & behaviour

Up to 366 uniquely identified observations. Null makes a gap rather than a fabricated zero. The chart provides latest/minimum/maximum descriptions and an optional exact data table. This compact chart is a read-only trend; Chart provides interactive point exploration.

Sparkline

Sparkline public properties
PropTypeDefault
dataRequiredreadonly SparklinePoint[]—
labelRequiredstring—
classNamestring | undefined—
formatIntl.NumberFormatOptions | undefined—
heightnumber | undefined60
localestring | undefined—
showDataboolean | undefinedtrue
tone"primary" | "accent" | undefined'primary'

SparklinePoint

SparklinePoint public properties
PropTypeDefault
idRequiredstring—
labelRequiredstring—
valueRequirednumber | null—

Tables come from the public TypeScript declarations. Related types and function parameters are shown alongside their component. A dash means no default is declared at the public function boundary.

Related controls

Notes to self

Test this component with real content, keyboard input and both themes. The example is a starting point; labels, error handling and behaviour still need to fit the application.