BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/fable-ui/charts

Charts

fable-ui/charts
FreeBlock

Render static AI-provided chart payloads using shadcn chart conventions and Recharts.

Live preview

live · rendered by the registry
Rendered by fable-ui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://fable-ui.shobky.com/r/charts.json

Source

components/fable-ui/charts/charts.tsxfable-ui.shobky.com/r/charts.json · first 6 KB
1"use client"
2
3import * as React from "react"
4import {
5 Bar,
6 BarChart,
7 CartesianGrid,
8 Cell,
9 Line,
10 LineChart,
11 Pie,
12 PieChart,
13 XAxis,
14 YAxis,
15} from "recharts"
16
17import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"
18import { Badge } from "@/components/ui/badge"
19import {
20 Card,
21 CardContent,
22 CardDescription,
23 CardHeader,
24 CardTitle,
25} from "@/components/ui/card"
26import {
27 ChartContainer,
28 ChartLegend,
29 ChartLegendContent,
30 ChartTooltip,
31 ChartTooltipContent,
32 type ChartConfig,
33} from "@/components/ui/chart"
34import {
35 Empty,
36 EmptyDescription,
37 EmptyHeader,
38 EmptyTitle,
39} from "@/components/ui/empty"
40import { Skeleton } from "@/components/ui/skeleton"
41import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs"
42import { cn } from "@/lib/utils"
43import { chartTypes, type ChartsProps, type ChartType } from "./charts.types"
44
45const chartTypeLabels: Record<ChartType, string> = {
46 line: "Line",
47 bar: "Bar",
48 pie: "Pie",
49}
50
51const chartColors = [
52 "var(--chart-1)",
53 "var(--chart-2)",
54 "var(--chart-3)",
55 "var(--chart-4)",
56 "var(--chart-5)",
57]
58
59type ResolvedSeries = {
60 key: string
61 label: string
62 color: string
63}
64
65type ChartProblem = {
66 title: string
67 description?: string
68}
69
70function normalizeChartTypes(types?: ChartType[]): ChartType[] {
71 const uniqueTypes = new Set(
72 types?.filter((type) => chartTypes.includes(type))
73 )
74
75 return uniqueTypes.size > 0 ? Array.from(uniqueTypes) : ["line"]
76}
77
78function isFiniteNumber(value: unknown): value is number {
79 return typeof value === "number" && Number.isFinite(value)
80}
81
82function toFiniteNumber(value: unknown) {
83 if (isFiniteNumber(value)) {
84 return value
85 }
86
87 if (typeof value === "string" && value.trim() !== "") {
88 const next = Number(value)
89 return Number.isFinite(next) ? next : undefined
90 }
91
92 return undefined
93}
94
95function getRowKeys(data: ChartsProps["data"]) {
96 const keys = new Set<string>()
97
98 for (const row of data) {
99 Object.keys(row).forEach((key) => keys.add(key))
100 }
101
102 return Array.from(keys)
103}
104
105function getNumericKeys(data: ChartsProps["data"], keys: string[]) {
106 return keys.filter((key) =>
107 data.some((row) => toFiniteNumber(row[key]) !== undefined)
108 )
109}
110
111function getTextKeys(data: ChartsProps["data"], keys: string[]) {
112 return keys.filter((key) =>
113 data.some((row) => {
114 const value = row[key]
115 return typeof value === "string" && value.trim() !== ""
116 })
117 )
118}
119
120function titleizeKey(key: string) {
121// … truncated

What it pulls in

npm packages

  • ai
  • zod
  • recharts

Other registry items

  • alert
  • card
  • badge
  • chart
  • empty
  • skeleton
  • tabs
  • shobky/fable-ui/core

Files it writes

  • components/fable-ui/charts/index.ts
  • components/fable-ui/charts/charts.tsx
  • components/fable-ui/charts/charts.types.ts
  • components/fable-ui/charts/tool-definition.ts
  • lib/fable-ui/tools/show-chart-tool.ts
  • lib/fable-ui/manifests/show-chart.md

Facts

Registry
fable-ui
Type
registry:block
Access
Free
Files written
6
Licence
MIT
First indexed
2026-08-04
Last confirmed
today

Go to the source

Docs on fable-ui fable-ui.shobky.com shobky/fable-ui on GitHub Raw registry item This item as JSON

More from fable-ui

All 10 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
DataBrowserdata-browserfable-uiBlocksFree4 deps · 21 files
Fable UI Quickstartquickstartfable-uiBlocksFree11 deps · 8 files
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex