BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/gymnopedies/chart

Chart

gymnopedies/chart
FreeComponent

Chart — gymnopédies-themed shadcn primitive.

Install it

npx shadcn@latest add https://gymnopedies.shoota.work/r/chart.json

Source

src/components/ui/chart.tsxgymnopedies.shoota.work/r/chart.json · first 6 KB
1import * as React from "react"
2import * as RechartsPrimitive from "recharts"
3import type { TooltipValueType } from "recharts"
4
5import { cn } from "@/lib/utils"
6
7// Format: { THEME_NAME: CSS_SELECTOR }
8const THEMES = { light: "", dark: ".dark" } as const
9
10const INITIAL_DIMENSION = { width: 320, height: 200 } as const
11type TooltipNameType = number | string
12
13export type ChartConfig = Record<
14 string,
15 {
16 label?: React.ReactNode
17 icon?: React.ComponentType
18 } & (
19 | { color?: string; theme?: never }
20 | { color?: never; theme: Record<keyof typeof THEMES, string> }
21 )
22>
23
24type ChartContextProps = {
25 config: ChartConfig
26}
27
28const ChartContext = React.createContext<ChartContextProps | null>(null)
29
30function useChart() {
31 const context = React.useContext(ChartContext)
32
33 if (!context) {
34 throw new Error("useChart must be used within a <ChartContainer />")
35 }
36
37 return context
38}
39
40function ChartContainer({
41 id,
42 className,
43 children,
44 config,
45 initialDimension = INITIAL_DIMENSION,
46 ...props
47}: React.ComponentProps<"div"> & {
48 config: ChartConfig
49 children: React.ComponentProps<
50 typeof RechartsPrimitive.ResponsiveContainer
51 >["children"]
52 initialDimension?: {
53 width: number
54 height: number
55 }
56}) {
57 const uniqueId = React.useId()
58 const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`
59
60 return (
61 <ChartContext.Provider value={{ config }}>
62 <div
63 data-slot="chart"
64 data-chart={chartId}
65 className={cn(
66 "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",
67 className
68 )}
69 {...props}
70 >
71 <ChartStyle id={chartId} config={config} />
72 <RechartsPrimitive.ResponsiveContainer
73 initialDimension={initialDimension}
74 >
75 {children}
76 </RechartsPrimitive.ResponsiveContainer>
77 </div>
78 </ChartContext.Provider>
79 )
80}
81// … truncated

What it pulls in

npm packages

  • recharts

Other registry items

  • https://gymnopedies.shoota.work/r/utils.json

Files it writes

  • src/components/ui/chart.tsx

Facts

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

Go to the source

gymnopedies.shoota.work shoota/gymnopedies on GitHub Raw registry item This item as JSON

More from gymnopedies

All 49 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
AccordionaccordiongymnopediesComponentsFree2 deps
AlertalertgymnopediesComponentsFree1 dep
Alert Dialogalert-dialoggymnopediesComponentsFree1 dep
ArticlearticlegymnopediesComponentsFreeno deps
Aspect Ratioaspect-ratiogymnopediesComponentsFreeno deps
AvataravatargymnopediesComponentsFree1 dep
BadgebadgegymnopediesComponentsFree2 deps
BreadcrumbbreadcrumbgymnopediesComponentsFree2 deps
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