Listed from the MCP registry; nobody on Odel publishes it.
Interactive charts, pivot tables, terminal cards, live TUI, and Excel export inside AI agents.
Runs on your machine from its package; the steps are below.

At most: only reads or looks up information.
Odel charges nothing per call. The publisher may charge for its own service.
Runs locally over stdio
This server isn't hosted — your MCP client launches it from a package registry. Use one of the commands below, or drop the config into your client (e.g. Claude Desktop).
Run
npx -y @smallwebco/tinypivot-mcp
MCP client config
{
"mcpServers": {
"tinypivot-data-analysis-studio-for-ai-agents": {
"command": "npx",
"args": [
"-y",
"@smallwebco/tinypivot-mcp"
]
}
}
}A data analysis studio for AI agents (MCP), plus lightweight React & Vue 3 data grids, pivot tables, charts and an embedded AI analyst.
TinyPivot MCP · Docs · Live Demo · Pricing · npm (@smallwebco/tinypivot-mcp)
⭐ If you find TinyPivot useful, please consider giving it a star! It helps others discover the project.
| Who it's for | Package | What it does |
|---|---|---|
| AI Users & Data Analysts | @smallwebco/tinypivot-mcp | Interactive Charts, Pivot Tables, Terminal Cards, Live Ghostty TUI, Drill-Through & Excel inside Antigravity, Claude Code / Desktop (native Plugin), Cursor, OpenCode, Codex CLI & pi (npx @smallwebco/tinypivot-mcp@latest init) |
| Frontend & SaaS Engineers | @smallwebco/tinypivot-react / -vue | Lightweight Excel-like <DataGrid /> with free Pivot Tables & Core Charts for React and Vue 3 apps |
| Product Teams | Embedded AI Data Analyst (BYOK) | Natural-language SQL querying inside your web app using your own OpenAI/Anthropic key over DuckDB WASM or Postgres |

Watch your agent work the data, and check every step. Your agent loads files, runs SQL and builds charts and pivot tables through @smallwebco/tinypivot-mcp. Each step appears live in TinyPivot Studio on localhost, with the agent's reason and the exact SQL behind it: edit and rerun that SQL, reopen any earlier result, and send the agent notes it picks up on its next step. In the chat, compact chart and table cards show progress. Totals come from @smallwebco/tinypivot-core, not from model arithmetic, and file rows stay out of the model's context.
npx @smallwebco/tinypivot-mcp@latest init to auto-detect and configure all installed AI harnesses, or install the bundled Claude Code / Desktop plugin (.claude-plugin/plugin.json + .mcp.json + skills/tinypivot/SKILL.md).npx @smallwebco/tinypivot-mcp@latest tui) plus localhost TinyPivot Studio.bar, stackedBar, line, area, pie, donut), Basic Pivot (sum), Code theme, Terminal Cards, Live Ghostty TUI, TinyPivot Studio, and up to 2,500 rows (with unmistakable UI + LLM warnings whenever a larger dataset is truncated — never silent truncation).load_file (and optional direct query_postgres) send only a short summary (a few hundred tokens: the chart card plus column notes) to the LLM and stream full rows locally to the UI at 0 tokens — and every local click (Chart ↔ Pivot ↔ Data, sort, filter, drill-through) costs $0.load_file, stdin pipe (... | tinypivot-mcp --open), or MCP/API piping to load_data (zero intermediate CSV needed for <500 in-memory rows) — plus an optional AST-validated read-only direct PostgreSQL connector (query_postgres on Pro).$149/yr, $399 Local Lifetime, or $699/yr Team 5-Seat): Unlocks unlimited rows, all 10 visual themes (Code, Phosphor, Nord, Thermal, Mono, Paper, Greenbar, 1-Bit, Amber CRT, Green CRT), double-click Drill-Through, all 9+ aggregations, styled .xlsx exports, watermark-free UI/terminal cards, and optional direct query_postgres (uses dedicated TP-MCP* keys).# 1. Auto-detect & wire Claude Code, Claude Desktop, Cursor, Antigravity, OpenCode, Codex CLI, and pi
npx @smallwebco/tinypivot-mcp@latest init
# 2. Or install as a native Claude Code plugin (includes .claude-plugin/plugin.json, .mcp.json & SKILL.md)
claude plugin install ./packages/mcp
# (or test for a single session without installing: claude --plugin-dir ./packages/mcp)
# 3. Attach the live Ghostty / split-pane TUI alongside your running AI agent
npx @smallwebco/tinypivot-mcp@latest tui
# 4. Or pipe any SQL CLI / CSV / JSON directly from stdin
duckdb -csv -c "SELECT * FROM 'sales.parquet'" | npx @smallwebco/tinypivot-mcp@latest --open
Privacy & Optional Env Vars: Row data, column names, SQL, and file paths never leave your machine. Disable minimal anonymous telemetry anytime with
TINYPIVOT_TELEMETRY=0orDO_NOT_TRACK=1. SetTINYPIVOT_LICENSE_KEYfor Pro/Team features and optionallyDATABASE_URL(+TINYPIVOT_ALLOWED_TABLES) for direct read-only PostgreSQL (query_postgres). See the full In-Agent Analytics (MCP) Guide andpackages/mcp/README.md.
| Feature | Free | Pro |
|---|---|---|
| Excel-like data grid | ✅ | ✅ |
| Column filtering & sorting | ✅ | ✅ |
| Global search | ✅ | ✅ |
| CSV export | ✅ | ✅ |
| Pagination | ✅ | ✅ |
| Column resizing | ✅ | ✅ |
| Clipboard (Ctrl+C) | ✅ | ✅ |
| Dark mode | ✅ | ✅ |
| Keyboard navigation | ✅ | ✅ |
| Pivot table with Sum aggregation | ✅ | ✅ |
| Row/column totals | ✅ | ✅ |
| Calculated fields with formulas | ✅ | ✅ |
| Pivot row group expand/collapse | ✅ | ✅ |
| Axis value filters (filter row/column items) | ✅ | ✅ |
| Pivot drill-through (double-click to inspect source rows) | ❌ | ✅ |
| Excel (XLSX) Export (styled, multi-level pivot headers, lazy-loaded) | ❌ | ✅ |
| AI Data Analyst (natural language queries, BYOK) | ❌ | ✅ |
| Chart Builder (6 chart types, drag-and-drop) | ❌ | ✅ |
| All aggregations (Count, Avg, Min, Max, Unique, Median, Std Dev, %) | ❌ | ✅ |
| No watermark | ❌ | ✅ |
pnpm add @smallwebco/tinypivot-vue
pnpm add @smallwebco/tinypivot-react
<script setup lang="ts">
import { DataGrid } from '@smallwebco/tinypivot-vue'
import '@smallwebco/tinypivot-vue/style.css'
const data = [
{ id: 1, region: 'North', product: 'Widget A', sales: 12500, units: 150 },
{ id: 2, region: 'North', product: 'Widget B', sales: 8300, units: 95 },
{ id: 3, region: 'South', product: 'Widget A', sales: 15200, units: 180 },
{ id: 4, region: 'South', product: 'Widget B', sales: 9800, units: 110 },
]
</script>
<template>
<DataGrid
:data="data"
:enable-export="true"
:enable-search="true"
:enable-pagination="true"
:page-size="100"
:enable-column-resize="true"
:enable-clipboard="true"
theme="light"
export-filename="my-data.csv"
/>
</template>
import { DataGrid } from '@smallwebco/tinypivot-react'
import '@smallwebco/tinypivot-react/style.css'
const data = [
{ id: 1, region: 'North', product: 'Widget A', sales: 12500, units: 150 },
{ id: 2, region: 'North', product: 'Widget B', sales: 8300, units: 95 },
{ id: 3, region: 'South', product: 'Widget A', sales: 15200, units: 180 },
{ id: 4, region: 'South', product: 'Widget B', sales: 9800, units: 110 },
]
export default function App() {
return (
<DataGrid
data={data}
enableExport={true}
enableSearch={true}
enablePagination={true}
pageSize={100}
enableColumnResize={true}
enableClipboard={true}
theme="light"
exportFilename="my-data.csv"
/>
)
}
| Prop | Type | Default | Description |
|---|---|---|---|
data | Record<string, unknown>[] | required | Array of data objects |
loading | boolean | false | Show loading spinner |
fontSize | 'xs' | 'sm' | 'base' | 'xs' | Font size preset |
showPivot | boolean | true | Show pivot toggle |
enableExport | boolean | true | Show the Export dropdown menu (CSV free / Excel .xlsx Pro) |
enableSearch | boolean | true | Show global search |
enablePagination | boolean | false | Enable pagination |
pageSize | number | 50 | Rows per page |
enableColumnResize | boolean | true | Drag to resize columns |
enableClipboard | boolean | true | Ctrl+C to copy cells |
theme | string | 'light' | Color theme — see Theming for the full list (22 presets) |
numberFormat | 'us' | 'eu' | 'plain' | 'us' | Number display format |
dateFormat | 'us' | 'eu' | 'iso' | 'iso' | Date display format |
fieldRoleOverrides | Record<string, FieldRole> | undefined | Override auto-detected chart field roles |
stripedRows | boolean | true | Alternating row colors |
exportFilename | string | 'data-export.csv' | CSV filename |
enableDrillDown | boolean | true | Enable pivot row group expand/collapse chevrons |
enableDrillThrough | boolean | true | Enable double-click drill-through on pivot cells (Pro feature) |
pivotLayout | 'grouped' | 'tabular' | 'grouped' | Row layout for multi-field pivots: 'grouped' merges repeated parent values into a spanning cell; 'tabular' repeats every value on each row. |
TinyPivot accepts an array of flat objects. Each object represents a row, and keys become column headers.
// ✅ Correct - flat objects with consistent keys
const data = [
{ id: 1, name: 'Alice', sales: 1500, region: 'North' },
{ id: 2, name: 'Bob', sales: 2300, region: 'South' },
{ id: 3, name: 'Carol', sales: 1800, region: 'North' },
]
// ❌ Avoid - nested objects (won't display correctly)
const badData = [
{ id: 1, user: { name: 'Alice' }, metrics: { sales: 1500 } }
]
| Type | Example | Display |
|---|---|---|
string | 'Hello' | As-is |
number | 1234.56 | Formatted per numberFormat prop |
boolean | true | true / false |
null / undefined | null | Empty cell |
Date | new Date() | Formatted per dateFormat prop |
Control how numbers and dates are displayed using the numberFormat and dateFormat props.
| Format | Example | Description |
|---|---|---|
'us' (default) | 1,234,567.89 | US format with comma separators |
'eu' | 1.234.567,89 | European format with period separators |
'plain' | 1234567.89 | No formatting or separators |
| Format | Example | Description |
|---|---|---|
'iso' (default) | 2024-03-15 | ISO 8601 (YYYY-MM-DD) |
'us' | 03/15/2024 | US format (MM/DD/YYYY) |
'eu' | 15/03/2024 | European format (DD/MM/YYYY) |
Date columns also support date range filtering. When a column is detected as date type, the filter UI shows date range inputs (From/To) with the appropriate format placeholder.
<!-- Vue -->
<DataGrid :data="data" number-format="eu" date-format="eu" />
{/* React */}
<DataGrid data={data} numberFormat="eu" dateFormat="eu" />
| Event | Payload | Description |
|---|---|---|
@cell-click | { row, col, value, rowData } | Cell clicked |
@selection-change | { cells, values } | Selection changed |
@export | { rowCount, filename } | CSV exported |
@copy | { text, cellCount } | Cells copied |
@collapse-change | string[] | Pivot row groups collapsed/expanded (array of collapsed path keys) |
@drill-through | DrillThroughResult | Pivot cell double-clicked and drill-through opened (Pro) |
<template>
<DataGrid
:data="data"
@cell-click="({ rowData }) => console.log(rowData)"
@export="({ rowCount }) => console.log(`Exported ${rowCount} rows`)"
/>
</template>
| Prop | Type | Description |
|---|---|---|
onCellClick | (payload) => void | Cell clicked |
onSelectionChange | (payload) => void | Selection changed |
onExport | (payload) => void | CSV exported |
onCopy | (payload) => void | Cells copied |
onCollapseChange | (collapsedPaths: string[]) => void | Pivot row groups collapsed/expanded |
onDrillThrough | (result: DrillThroughResult) => void | Pivot cell double-clicked and drill-through opened (Pro) |
<DataGrid
data={data}
onCellClick={({ rowData }) => console.log(rowData)}
onExport={({ rowCount }) => console.log(`Exported ${rowCount} rows`)}
/>
| Shortcut | Action |
|---|---|
Ctrl+C / Cmd+C | Copy selected cells |
Ctrl+F / Cmd+F | Focus search input |
Arrow keys | Navigate cells |
Shift+Arrow | Extend selection |
Escape | Clear selection/search |
TinyPivot includes 9 built-in aggregation functions plus support for custom calculations:
| Function | Symbol | Description |
|---|---|---|
| Sum | Σ | Total of all values |
| Count | # | Number of values |
| Average | x̄ | Mean of all values |
| Min | ↓ | Minimum value |
| Max | ↑ | Maximum value |
| Unique | ◇ | Count of distinct values |
| Median | M̃ | Middle value (outlier-resistant) |
| Std Dev | σ | Standard deviation (spread measure) |
| % of Total | %Σ | Percentage contribution to grand total |
| Custom | ƒ | Your own aggregation function |
TinyPivot Pro includes an optional AI Data Analyst that lets users explore data using natural language. Ask questions like "What's the return rate by category?" or "Show me sales trends over time" and get instant SQL-generated results.

Want to try it? See the complete working example in
examples/ai-analyst-demo/with PostgreSQL backend and DuckDB WASM for client-side queries.
To enable the AI Data Analyst, you need:
setLicenseKey('YOUR_LICENSE_KEY') at app startupaiAnalyst prop with enabled: truedataSources and dataSourceLoaderThe AI Analyst automatically understands relationships between your tables and can generate JOIN queries when needed. Ask questions like:
The AI sees all available table schemas and identifies foreign key relationships (columns ending in _id) to construct proper JOINs.
# .env
DATABASE_URL=postgresql://user:password@localhost:5432/mydb
AI_API_KEY=sk-... # OpenAI, Anthropic, or OpenRouter key
# Optional: Override the default model
AI_MODEL=claude-sonnet-4-20250514
The AI provider is auto-detected from your API key format:
sk-ant-... → Anthropic (defaults to claude-3-haiku-20240307)sk-or-... → OpenRouter (defaults to anthropic/claude-3-haiku)sk-... → OpenAI (defaults to gpt-4o-mini)Default models are cheap/fast. Set AI_MODEL for better quality.
One unified endpoint handles table discovery, schema, queries, and AI chat:
// Backend: app/api/tinypivot/route.ts (Next.js App Router)
import { createTinyPivotHandler } from '@smallwebco/tinypivot-server'
export const POST = createTinyPivotHandler({
tables: {
include: ['sales', 'customers', 'products'], // Only expose these tables
descriptions: {
sales: 'Sales transactions with revenue data',
}
}
})
<!-- Frontend: Vue -->
<script setup lang="ts">
import { DataGrid, setLicenseKey } from '@smallwebco/tinypivot-vue'
import '@smallwebco/tinypivot-vue/style.css'
// Activate Pro license
setLicenseKey('YOUR_LICENSE_KEY')
const aiAnalystConfig = {
enabled: true,
endpoint: '/api/tinypivot',
}
</script>
<template>
<DataGrid
:data="[]"
:ai-analyst="aiAnalystConfig"
/>
</template>
// Frontend: React
import { DataGrid, setLicenseKey } from '@smallwebco/tinypivot-react'
import '@smallwebco/tinypivot-react/style.css'
// Activate Pro license
setLicenseKey('YOUR_LICENSE_KEY')
function App() {
return (
<DataGrid
data={[]}
aiAnalyst={{ enabled: true, endpoint: '/api/tinypivot' }}
/>
)
}
For client-side data that's already loaded in the browser, you must configure dataSources and dataSourceLoader to make your data available to the AI Analyst:
<!-- Vue 3 -->
<script setup lang="ts">
import { ref } from 'vue'
import { DataGrid, setLicenseKey } from '@smallwebco/tinypivot-vue'
import '@smallwebco/tinypivot-vue/style.css'
// Activate Pro license
setLicenseKey('YOUR_LICENSE_KEY')
// Your data
const salesData = ref([
{ id: 1, region: 'North', product: 'Widget A', sales: 12500, units: 150 },
{ id: 2, region: 'South', product: 'Widget B', sales: 8300, units: 95 },
// ... more data
])
// Helper to infer schema from data
function inferSchema(data: Record<string, unknown>[]) {
if (!data.length) return []
const sample = data[0]
return Object.entries(sample).map(([name, value]) => ({
name,
type: typeof value === 'number' ? 'number' : typeof value === 'boolean' ? 'boolean' : 'string',
}))
}
// AI Analyst configuration
const aiAnalystConfig = {
enabled: true, // Required: explicitly enable
endpoint: '/api/ai-chat', // Your AI proxy endpoint
dataSources: [ // Required: define available data sources
{
id: 'sales',
table: 'sales',
name: 'Sales Data',
description: 'Sales transactions with region, product, sales amount, and units',
},
],
dataSourceLoader: async (id: string) => { // Required: return data + schema
if (id === 'sales') {
return {
data: salesData.value,
schema: inferSchema(salesData.value),
}
}
throw new Error(`Unknown data source: ${id}`)
},
persistToLocalStorage: true, // Optional: save conversations
sessionId: 'my-session', // Optional: conversation ID
}
</script>
<template>
<DataGrid
:data="salesData"
:ai-analyst="aiAnalystConfig"
/>
</template>
// React
import { useState } from 'react'
import { DataGrid, setLicenseKey } from '@smallwebco/tinypivot-react'
import '@smallwebco/tinypivot-react/style.css'
// Activate Pro license
setLicenseKey('YOUR_LICENSE_KEY')
function inferSchema(data: Record<string, unknown>[]) {
if (!data.length) return []
const sample = data[0]
return Object.entries(sample).map(([name, value]) => ({
name,
type: typeof value === 'number' ? 'number' : typeof value === 'boolean' ? 'boolean' : 'string',
}))
}
function App() {
const [salesData] = useState([
{ id: 1, region: 'North', product: 'Widget A', sales: 12500, units: 150 },
{ id: 2, region: 'South', product: 'Widget B', sales: 8300, units: 95 },
// ... more data
])
const aiAnalystConfig = {
enabled: true,
endpoint: '/api/ai-chat',
dataSources: [
{
id: 'sales',
table: 'sales',
name: 'Sales Data',
description: 'Sales transactions with region, product, sales amount, and units',
},
],
dataSourceLoader: async (id: string) => {
if (id === 'sales') {
return {
data: salesData,
schema: inferSchema(salesData),
}
}
throw new Error(`Unknown data source: ${id}`)
},
persistToLocalStorage: true,
sessionId: 'my-session',
}
return (
<DataGrid
data={salesData}
aiAnalyst={aiAnalystConfig}
/>
)
}
For browser-based SQL execution with DuckDB WASM, add a queryExecutor:
const aiConfig = {
enabled: true,
endpoint: '/api/ai-proxy', // Server endpoint for AI chat
queryExecutor: async (sql, table) => {
// Execute SQL via DuckDB WASM (client-side)
const result = await duckdb.query(sql)
return { data: result.toArray(), rowCount: result.numRows }
},
dataSources: [
{ id: 'sales', table: 'sales', name: 'Sales Data', description: '...' }
],
dataSourceLoader: async (id) => {
// Load data into DuckDB and return schema
const data = await fetchData(id)
await duckdb.loadTable(id, data)
return { data, schema: inferSchema(data) }
}
}
const aiConfig = {
endpoint: '/api/tinypivot',
sessionId: 'user-123',
persistToLocalStorage: true, // Auto-save conversations
}
The server handler includes built-in protections:
READ ONLY, so writes cannot succeed even if validation is bypassedpg_read_file, dblink, set_config, ...) are rejectedThe handler does not authenticate callers — put it behind your own auth and rate limiting.
See @smallwebco/tinypivot-server for full documentation
For a complete working example with PostgreSQL backend, see the AI Analyst Demo:
cd examples/ai-analyst-demo
cp .env.example .env
# Edit .env with your DATABASE_URL and AI_API_KEY
pnpm install
pnpm dev:all
TinyPivot Pro includes a drag-and-drop chart builder with 6 chart types. Simply drag fields to configure your visualization — dimensions go to the X-axis and measures to the Y-axis.
| Chart Type | Best For |
|---|---|
| Bar | Comparing categories, rankings |
| Line | Trends over time, continuous data |
| Area | Volume trends, stacked comparisons |
| Pie | Part-to-whole proportions |
| Donut | Proportions with center metric |
| Radar | Multi-metric comparison |
Charts automatically respect any filters applied in Grid view — filter your data, then visualize the subset.
The Chart Builder automatically classifies each column as a dimension (category/grouping), measure (aggregatable number), or temporal (date/time) using heuristics on your data.
How it works:
number types are classified as measures — if your data layer has already cast values to numbers, TinyPivot trusts that intent regardless of cardinality"1", "2", "3") are classified as dimensions (they could be category IDs)Overriding field roles:
When the auto-detection doesn't match your intent, use fieldRoleOverrides to explicitly set roles:
<!-- Vue -->
<DataGrid
:data="data"
:field-role-overrides="{
'Answer Score': 'measure',
'Question Order': 'dimension',
'Company Size': 'measure',
}"
/>
{/* React */}
<DataGrid
data={data}
fieldRoleOverrides={{
"Answer Score": "measure",
"Question Order": "dimension",
"Company Size": "measure",
}}
/>
Available roles: 'dimension' | 'measure' | 'temporal'
This is useful when:
When enableExport is true (the default), the toolbar shows a single Export dropdown button. Clicking it opens a menu with two items:
.csv file of the current view (grid or pivot)..xlsx download. exceljs (~250 KB) is loaded lazily via dynamic import and is never part of your main bundle.Programmatic API:
import { exportToCSV, exportPivotToCSV } from '@smallwebco/tinypivot-vue' // or -react
exportToCSV(data, columns, { filename: 'my-data.csv' })
Styled .xlsx downloads for both the flat grid and the pivot table. Both functions are async and trigger a browser download:
import { exportToXLSX, exportPivotToXLSX } from '@smallwebco/tinypivot-vue' // or -react
import type { XlsxExportOptions } from '@smallwebco/tinypivot-vue'
// Flat grid
await exportToXLSX(data, columns, {
filename: 'report.xlsx',
sheetName: 'Sales',
numberFormats: { revenue: '#,##0.00', units: '#,##0' },
})
// Pivot table
await exportPivotToXLSX(pivotData, rowFields, columnFields, valueFields, {
filename: 'pivot-report.xlsx',
sheetName: 'Pivot',
})
XlsxExportOptions extends ExportOptions and adds sheetName?: string and numberFormats?: Record<string, string>.
When exporting a pivot table to Excel, TinyPivot produces a two-sheet workbook:
TableStyleMedium2 with filter/sort dropdowns on every column). In Excel, select any cell in this table and go to Insert → PivotTable to build a native Excel PivotTable in two clicks.Note: TinyPivot does not generate a native Excel PivotTable object — the library used (exceljs) does not support writing pivot table XML. The Source Data sheet is the practical alternative: it gives users full access to the raw rows inside Excel so they can create a PivotTable themselves.
TinyPivot supports two complementary pivot drill-down capabilities:
When a pivot has two or more row fields, each group row displays a ▸/▾ chevron. Click to collapse or expand that group. Alt-click collapses/expands every group at the same depth at once. Collapsed groups still show correct aggregated values (sum, median, stdDev, etc.) over all rows in the group.
By default (pivotLayout="grouped"), the parent row value is rendered once as a vertically spanning cell across its children, making the hierarchy immediately readable. Set pivotLayout="tabular" to repeat the parent value on every row instead.
Controlled with the enableDrillDown prop (default true).
<!-- Vue -->
<DataGrid
:data="data"
@collapse-change="(collapsedPaths) => console.log('Collapsed:', collapsedPaths)"
/>
// React
<DataGrid
data={data}
onCollapseChange={(collapsedPaths) => console.log('Collapsed:', collapsedPaths)}
/>
Double-click any pivot value cell (including totals) to open a modal showing the underlying source rows that contributed to that cell. The modal includes a header with the slice description, paginated rows (50/page), and a CSV export of the drill-through result.
Requires a Pro license. Controlled with the enableDrillThrough prop (default true).
<!-- Vue -->
<DataGrid
:data="data"
@drill-through="({ rows, descriptor }) => console.log(`${descriptor.rowCount} rows for ${descriptor.rowPath.join(' > ')}`)"
/>
// React
<DataGrid
data={data}
onDrillThrough={({ rows, descriptor }) =>
console.log(`${descriptor.rowCount} rows for ${descriptor.rowPath.join(' > ')}`)
}
/>
import type { DrillThroughResult, DrillThroughDescriptor, PivotRowMeta } from '@smallwebco/tinypivot-vue'
// or '@smallwebco/tinypivot-react'
// DrillThroughResult — payload of the drill-through event
interface DrillThroughResult {
rows: Record<string, unknown>[] // Source rows matching the clicked cell's slice
descriptor: DrillThroughDescriptor
}
interface DrillThroughDescriptor {
rowPath: string[] // e.g. ['West', 'Widgets']
columnPath: string[] // e.g. ['Q3']
valueField: string // e.g. 'sales'
aggregation: AggregationFunction
formattedValue: string // Pre-formatted result, e.g. '1,234'
rowCount: number
}
TinyPivot supports three types of custom calculations:
Pass your own aggregation logic via the customFn property:
// Vue
const valueFields = ref([
{
field: 'sales',
aggregation: 'custom',
customFn: (values) => {
// 90th percentile
const sorted = [...values].sort((a, b) => a - b)
return sorted[Math.floor(sorted.length * 0.9)]
},
customLabel: '90th Percentile',
customSymbol: 'P90'
}
])
// React
const valueFields = [
{
field: 'sales',
aggregation: 'custom',
customFn: (values) => {
// Interquartile mean
const sorted = [...values].sort((a, b) => a - b)
const q1 = Math.floor(sorted.length * 0.25)
const q3 = Math.floor(sorted.length * 0.75)
const middle = sorted.slice(q1, q3)
return middle.reduce((a, b) => a + b, 0) / middle.length
},
customLabel: 'IQR Mean',
customSymbol: 'IQM'
}
]
Create fields that compute values from other aggregations using a formula builder:
SUM(profit) / SUM(revenue) * 100Supported functions in formulas:
SUM(field) - Sum of valuesAVG(field) - Average of valuesMIN(field) - Minimum valueMAX(field) - Maximum valueCOUNT(field) - Count of valuesMEDIAN(field) - Median valueExample formulas:
SUM(profit) / SUM(revenue) * 100 → Profit margin %
SUM(revenue) / SUM(units) → Average price per unit
(MAX(sales) - MIN(sales)) / AVG(sales) → Coefficient of variation
Add calculated fields via props:
// Vue
const calculatedFields = ref([
{
id: 'margin',
name: 'Profit Margin %',
formula: 'SUM(profit) / SUM(revenue) * 100',
formatAs: 'percent',
decimals: 1
},
{
id: 'avg_price',
name: 'Avg Price',
formula: 'SUM(revenue) / SUM(units)',
formatAs: 'currency',
decimals: 2
}
])
import type {
CalculatedField,
CustomAggregationFn,
PivotValueField
} from '@smallwebco/tinypivot-vue'
// Custom aggregation function signature
type CustomAggregationFn = (
values: number[],
allFieldValues?: Record<string, number[]>
) => number | null
// Calculated field definition
interface CalculatedField {
id: string
name: string
formula: string
formatAs?: 'number' | 'percent' | 'currency'
decimals?: number
}
Unlock advanced aggregations, charts, AI Data Analyst, and remove the watermark with a Pro license.
TinyPivot Pro uses a lifetime license — buy once, set your key, and keep shipping.
import { setLicenseKey } from '@smallwebco/tinypivot-vue'
// Call once at app startup
setLicenseKey('YOUR_LICENSE_KEY')
import { setLicenseKey } from '@smallwebco/tinypivot-react'
// Call once at app startup
setLicenseKey('YOUR_LICENSE_KEY')
| Plan | Price | Use Case |
|---|---|---|
| Single Project | $49 | One application |
| Unlimited Projects | $149 | All your projects |
| Team License | $399 | Up to 10 developers |
Purchase at tiny-pivot.com/pricing
TinyPivot uses scoped styles and won't conflict with your app. Import the base styles:
// Vue
import '@smallwebco/tinypivot-vue/style.css'
// React
import '@smallwebco/tinypivot-react/style.css'
TinyPivot ships 27 themes — 2 neutral (light, dark), 10 brand themes each with a light and dark variant, and 5 unified themes that style the grid and its charts together. Themes are applied via the theme prop on DataGrid.
<!-- Vue -->
<DataGrid :data="data" theme="slate-dark" />
{/* React */}
<DataGrid data={data} theme="slate-dark" />
theme="auto" resolves to 'light' or 'dark' based on the user's system preference.
| Theme | Accent | Vibe |
|---|---|---|
light / dark / auto | indigo / violet | Default — neutral cool grays |
slate / slate-dark | #4f46e5 indigo | Linear / Stripe — cool neutral |
zinc / zinc-dark | near-mono | Vercel / Anthropic — minimalist |
indigo / indigo-dark | #6366f1 indigo | Premium SaaS |
violet / violet-dark | #8b5cf6 purple | Data viz / AI tools |
emerald / emerald-dark | #10b981 green | Fintech / finance |
sky / sky-dark | #0ea5e9 light blue | Productivity / airy |
rose / rose-dark | #f43f5e warm pink | Friendly / creator |
amber / amber-dark | #f59e0b warm orange | Energy / wellness |
solar / solar-dark | #b58900 mustard | Solarized — warm cream + dark teal |
mono / mono-dark | #000 / #fff | Editorial — pure grayscale |
A unified theme styles the grid, pivot table and charts as one. Set it once on theme; charts pick up the matching palette and rendering style automatically (pass chartTheme to override).
| Theme | Surface | Charts |
|---|---|---|
paper | Warm paper, black ink, orange accent | Flat fills, square bars |
greenbar | Ledger printer paper with green stripes | Flat fills, square bars |
onebit | One ink, square corners, hard shadow | Pattern fills instead of colour |
crt-amber | Dark amber phosphor with scanlines | Flat marks with glow |
crt-green | Dark green phosphor with scanlines | Flat marks with glow |
The same five ids are valid chartTheme values, so <DataGrid theme="slate" chartTheme="paper" /> also works. The MCP widget and terminal output use the same names.
Each theme redefines ~30 CSS custom property tokens at the grid root. Override them in your own CSS for a custom theme:
.vpg-data-grid.my-brand {
--vpg-accent: #ff6b35;
--vpg-accent-hover: #e55426;
--vpg-surface-bg: #fafaf7;
--vpg-surface-panel: #f0eee7;
/* …override any other token */
}
<!-- Vue -->
<DataGrid :data="data" theme="light" class="my-brand" />
{/* React */}
<DataGrid data={data} theme="light" className="my-brand" />
Token reference:
--vpg-surface-bg, --vpg-surface-panel, --vpg-surface-elevated, --vpg-surface-hover, --vpg-surface-selected, --vpg-surface-striped--vpg-text-primary, --vpg-text-secondary, --vpg-text-muted, --vpg-text-inverse--vpg-border-default, --vpg-border-strong, --vpg-border-subtle--vpg-accent, --vpg-accent-hover, --vpg-accent-soft-bg, --vpg-accent-soft-text, --vpg-focus-ring--vpg-state-error, --vpg-state-warning, --vpg-state-success, --vpg-state-info--vpg-dim-row-*, --vpg-dim-col-*, --vpg-dim-value-*, --vpg-dim-calc-* (each with -bg, -text, -border)--vpg-highlight-bg, --vpg-highlight-text, --vpg-highlight-border--vpg-scrollbar-thumb, --vpg-scrollbar-trackCustom theme classes layer on top of any preset, so you can start from theme="dark" and tweak just the accent.
Full TypeScript support included. Import types as needed:
// React
import type {
AggregationFunction,
DataGridProps,
FieldRole,
FieldRoleOverrides,
PivotConfig,
} from '@smallwebco/tinypivot-react'
// Vue
import type {
AggregationFunction,
CellClickEvent,
DataGridProps,
FieldRole,
FieldRoleOverrides,
PivotConfig,
SelectionChangeEvent,
} from '@smallwebco/tinypivot-vue'
TinyPivot is source-available (dual-licensed):
See LICENSE.md for full terms.
This repository uses the following topics for discoverability:
ai-data-analyst, embedded-analytics, conversational-bi, natural-language-query, text-to-sql, byok, llm-integration, vue, vue3, react, data-grid, pivot-table, chart-builder, data-visualization, excel, spreadsheet, datagrid, table-component, aggregation, csv-export
Built with ❤️ by Small Web, LLC