Lemma Insights
lemma/lemma-insightsUnverifiedBlock
Dashboard-style stat cards and charts driven by table queries or function outputs. Supports count/sum/avg stat cards and bar/line/area/pie/funnel charts. Built on recharts.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/lemma-work/lemma-platform/main/lemma-typescript/lemma-insights.jsonSource
1"use client"23import * as React from "react"4import { BarChart3, TrendingUp, TrendingDown, Minus } from "lucide-react"5import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/lemma/ui/card"6import { useRecords, useFunctionRun } from "lemma-sdk/react"7import type { LemmaClient, RecordFilter } from "lemma-sdk"8import { cn } from "@/components/lemma/lib/utils"9import {10 BarChart,11 Bar,12 AreaChart,13 Area,14 LineChart,15 Line,16 PieChart,17 Pie,18 Cell,19 XAxis,20 YAxis,21 CartesianGrid,22 Tooltip,23 Legend,24 ResponsiveContainer,25} from "recharts"2627const CHART_COLORS = [28 "var(--chart-1)",29 "var(--chart-2)",30 "var(--chart-3)",31 "var(--chart-4)",32 "var(--chart-5)",33]3435export type StatSource =36 | { type: "count"; table: string; filters?: RecordFilter[]; label?: string }37 | { type: "sum"; table: string; field: string; filters?: RecordFilter[]; label?: string }38 | { type: "avg"; table: string; field: string; filters?: RecordFilter[]; label?: string }39 | { type: "function"; functionName: string; input?: Record<string, unknown>; extractPath?: string; label?: string }4041export type ChartSource =42 | {43 type: "bar" | "line" | "area" | "funnel"44 table: string45 category: string46 value?: string47 aggregate?: "count" | "sum" | "avg"48 filters?: RecordFilter[]49 sortBy?: "category" | "value"50 order?: "asc" | "desc"51 limit?: number52 }53 | {54 type: "pie"55 table: string56 category: string57 value?: string58 aggregate?: "count" | "sum" | "avg"59 filters?: RecordFilter[]60 sortBy?: "category" | "value"61 order?: "asc" | "desc"62 limit?: number63 }64 | {65 type: "bar" | "line" | "area" | "pie" | "funnel"66 table?: undefined67 function: string68 input?: Record<string, unknown>69 extractPath?: string70 }7172export interface StatCardDef {73 source: StatSource74 title: string75 format?: (value: number) => string76 trend?: "up" | "down" | "flat"77 trendLabel?: string78}7980export interface ChartCardDef {81 source: ChartSource82 title: string83 description?: string84 height?: number85 valueFormatter?: (value: number) => string86 categoryFormatter?: (value: string) => string87 footer?: React.ReactNode88 emptyState?: React.ReactNode89}9091export type LemmaInsightsRadius = "none" | "sm" | "md" | "lg" | "xl"9293export type AggregationMode = "client" | "function"9495export interface LemmaInsightsProps {96 client: LemmaClient97 podId?: string98// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from lemma
All 20 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Lemma Action Surfacelemma-action-surface | lemma | Blocks | Unverified | 4 deps | |
| Lemma Activity Feedlemma-activity-feed | lemma | Blocks | Unverified | 4 deps · 3 files | |
| Lemma Agent Conversation Experiencelemma-assistant-experience | lemma | Blocks | Unverified | 7 deps · 3 files | |
| Lemma Breadcrumbslemma-breadcrumbs | lemma | Blocks | Unverified | 3 deps | |
| Lemma Commentslemma-comments | lemma | Blocks | Unverified | 4 deps · 3 files | |
| Lemma Detail Panellemma-detail-panel | lemma | Blocks | Unverified | 4 deps · 7 files | |
| Lemma Document Workspacelemma-document-workspace | lemma | Blocks | Unverified | 6 deps | |
| Lemma File Browserlemma-file-browser | lemma | Blocks | Unverified | 4 deps |
