BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/gr8monk3ys/chart

chart

gr8monk3ys/chart
FreeComponent

chart (identity-styled).

Install it

npx shadcn@latest add https://ui.lscaturchio.xyz/r/chart.json

Source

components/ui/chart.tsxui.lscaturchio.xyz/r/chart.json · first 6 KB
1"use client"
2
3import * as React from "react"
4import * as RechartsPrimitive from "recharts"
5import type { TooltipValueType } from "recharts"
6
7import { cn } from "@/lib/utils"
8
9// Format: { THEME_NAME: CSS_SELECTOR }
10const THEMES = { light: "", dark: ".dark" } as const
11
12const INITIAL_DIMENSION = { width: 320, height: 200 } as const
13type TooltipNameType = number | string
14
15export type ChartConfig = Record<
16 string,
17 {
18 label?: React.ReactNode
19 icon?: React.ComponentType
20 } & (
21 | { color?: string; theme?: never }
22 | { color?: never; theme: Record<keyof typeof THEMES, string> }
23 )
24>
25
26type ChartContextProps = {
27 config: ChartConfig
28}
29
30const ChartContext = React.createContext<ChartContextProps | null>(null)
31
32function useChart() {
33 const context = React.useContext(ChartContext)
34
35 if (!context) {
36 throw new Error("useChart must be used within a <ChartContainer />")
37 }
38
39 return context
40}
41
42function ChartContainer({
43 id,
44 className,
45 children,
46 config,
47 initialDimension = INITIAL_DIMENSION,
48 ...props
49}: React.ComponentProps<"div"> & {
50 config: ChartConfig
51 children: React.ComponentProps<
52 typeof RechartsPrimitive.ResponsiveContainer
53 >["children"]
54 initialDimension?: {
55 width: number
56 height: number
57 }
58}) {
59 const uniqueId = React.useId()
60 const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`
61
62 return (
63 <ChartContext.Provider value={{ config }}>
64 <div
65 data-slot="chart"
66 data-chart={chartId}
67 className={cn(
68 "flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
69 className
70 )}
71 {...props}
72 >
73 <ChartStyle id={chartId} config={config} />
74 <RechartsPrimitive.ResponsiveContainer
75 initialDimension={initialDimension}
76 >
77 {children}
78 </RechartsPrimitive.ResponsiveContainer>
79 </div>
80// … truncated

What it pulls in

npm packages

  • recharts@3.8.0
  • lucide-react

Other registry items

  • https://ui.lscaturchio.xyz/r/card.json

Files it writes

  • components/ui/chart.tsx

Facts

Registry
gr8monk3ys
Type
registry:ui
Access
Free
Files written
1
Licence
GPL-3.0
First indexed
2026-08-09
Last confirmed
today

Go to the source

ui.lscaturchio.xyz gr8monk3ys/ui on GitHub Raw registry item This item as JSON

More from gr8monk3ys

All 69 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Accordionaccordiongr8monk3ysComponentsFree2 deps
ActiveNavLinkactive-nav-linkgr8monk3ysComponentsFreeno deps · 2 files
alertalertgr8monk3ysComponentsFree1 dep
alert-dialogalert-dialoggr8monk3ysComponentsFree1 dep
aspect-ratioaspect-ratiogr8monk3ysComponentsFree1 dep
attachmentattachmentgr8monk3ysComponentsFree2 deps
Avataravatargr8monk3ysComponentsFree1 dep
Badgebadgegr8monk3ysComponentsFree1 dep
BlockDex

Built by

Kynth Studios

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 Studios

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 Studios

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