Skip to main content

sparkline

inline SVG line / area / bar.

The sparkline cell rendered in a Bst-Table grid

Example source
import React from 'react'
import { BstTableMui } from '@bloomskill/table-mui'
import type { BstTableColumn } from '@bloomskill/table-engine'
import '@bloomskill/table-engine/styles.css'
const rows = [{ id:'1', item:'Nimbus', v:[3,5,4,6,7,9] }, { id:'2', item:'Stratus', v:[8,6,7,5,4,3] }]
const columns: BstTableColumn<any>[] = [
{ id: 'item', accessorKey: 'item', header: 'Item' },
{ id:'v', accessorKey:'v', header:'Trend', meta:{ type:'sparkline', cellMeta:{ variant:'area' } } },
]
export default function App() {
return <BstTableMui data={rows} columns={columns} getRowId={(r) => r.id} pagination={false} />
}
Loading live example…

Guide

When to use it

An inline trend — a mini chart of a series in a single cell, with no charting library.

How it works

Reads a number[] (or a '1,2,3' string) and draws a dependency-free inline-SVG chart. Read-only.

Options

  • cellMeta.variant'line' (default) | 'area' | 'bar'.
  • cellMeta.color, width, height, min, max, showValue.

At a glance

Rendersinline SVG line / area / bar
Value shapenumber[] (or "1,2,3")
Editableread-only
Key cellMetavariant, width, height, color, min, max, showValue

Use it

const columns: BstTableColumn<Row>[] = [
{ id: 'x', accessorKey: 'x', header: 'X', meta: { type: 'sparkline', /* cellMeta below */ } },
]

cellMeta options

sparkline — value is number[] (or a comma string).

cellMetaTypeEffect
variant'line' | 'area' | 'bar'Chart style. Default 'line'.
width / heightnumberSVG size in px. Default 84 × 22.
colorCSS colorStroke/fill. Default the accent var.
min / maxnumberFix the value scale (else auto from data).
showValuebooleanAppend the last value as text.