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

agentmesh/chart
FreeComponent

shadcn/ui publishes no description for this item.

Live preview

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

Install it

npx shadcn@latest add https://raw.githubusercontent.com/ombhanushaliii/agentmesh/main/example/ui/apps/v4/public/r/styles/base-vega/chart.json

Source

registry/base-vega/ui/chart.tsxraw.githubusercontent.com/ombhanushaliii/agentmesh/main/example/ui/apps/v4/public/r/styles/base-vega/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 "@/registry/base-vega/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

Other registry items

  • card

Files it writes

  • registry/base-vega/ui/chart.tsx

Facts

Registry
shadcn/ui
Type
registry:ui
Access
Free
Files written
1
Licence
the repository states none
First indexed
2026-08-01
Last confirmed
3 days ago

Go to the source

Docs on shadcn/ui ombhanushaliii/agentmesh on GitHub Raw registry item This item as JSON

More from shadcn/ui

All 201 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