BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/shadcn/ui/chart

chart

agileflow-projectquestorg/chart
FreeComponent

shadcn/ui publishes no description for this item.

Install it

npx shadcn@latest add https://raw.githubusercontent.com/projectquestorg/AgileFlow/main/apps/docs/public/r/styles/radix-nova/chart.json

Source

registry/radix-nova/ui/chart.tsxraw.githubusercontent.com/projectquestorg/AgileFlow/main/apps/docs/public/r/styles/radix-nova/chart.json · first 6 KB
1"use client"
2
3import * as React from "react"
4import * as RechartsPrimitive from "recharts"
5
6import { cn } from "@/registry/bases/radix/lib/utils"
7
8// Format: { THEME_NAME: CSS_SELECTOR }
9const THEMES = { light: "", dark: ".dark" } as const
10
11export type ChartConfig = {
12 [k in string]: {
13 label?: React.ReactNode
14 icon?: React.ComponentType
15 } & (
16 | { color?: string; theme?: never }
17 | { color?: never; theme: Record<keyof typeof THEMES, string> }
18 )
19}
20
21type ChartContextProps = {
22 config: ChartConfig
23}
24
25const ChartContext = React.createContext<ChartContextProps | null>(null)
26
27function useChart() {
28 const context = React.useContext(ChartContext)
29
30 if (!context) {
31 throw new Error("useChart must be used within a <ChartContainer />")
32 }
33
34 return context
35}
36
37function ChartContainer({
38 id,
39 className,
40 children,
41 config,
42 ...props
43}: React.ComponentProps<"div"> & {
44 config: ChartConfig
45 children: React.ComponentProps<
46 typeof RechartsPrimitive.ResponsiveContainer
47 >["children"]
48}) {
49 const uniqueId = React.useId()
50 const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`
51
52 return (
53 <ChartContext.Provider value={{ config }}>
54 <div
55 data-slot="chart"
56 data-chart={chartId}
57 className={cn(
58 "[&_.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-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 flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
59 className
60 )}
61 {...props}
62 >
63 <ChartStyle id={chartId} config={config} />
64 <RechartsPrimitive.ResponsiveContainer>
65 {children}
66 </RechartsPrimitive.ResponsiveContainer>
67 </div>
68 </ChartContext.Provider>
69 )
70}
71
72const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
73 const colorConfig = Object.entries(config).filter(
74 ([, config]) => config.theme || config.color
75 )
76
77 if (!colorConfig.length) {
78 return null
79 }
80
81 return (
82 <style
83// … truncated

What it pulls in

npm packages

  • recharts@2.15.4

Files it writes

  • registry/radix-nova/ui/chart.tsx

Facts

Registry
shadcn/ui
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-03
Last confirmed
yesterday

Go to the source

agileflow.projectquestorg.com projectquestorg/AgileFlow on GitHub Raw registry item This item as JSON

More from shadcn/ui

All 133 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
accordionaccordionshadcn/uiComponentsFreeno deps
alertalertshadcn/uiComponentsFreeno deps
alert-dialogalert-dialogshadcn/uiComponentsFreeno deps
aspect-ratioaspect-ratioshadcn/uiComponentsFreeno deps
avataravatarshadcn/uiComponentsFreeno deps
badgebadgeshadcn/uiComponentsFreeno deps
breadcrumbbreadcrumbshadcn/uiComponentsFreeno deps
buttonbuttonshadcn/uiComponentsFreeno 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