BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/neobrutal-ui/chart

Chart

neobrutal-ui/chart
FreeComponent

neobrutal-ui publishes no description for this item.

Live preview

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

Install it

npx shadcn@latest add https://neobrutal-ui.andongmin.com/r/chart.json

Source

src/components/ui/chart.tsxneobrutal-ui.andongmin.com/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<typeof RechartsPrimitive.ResponsiveContainer>["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 min-w-[232px] aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-[#80808080] [&_.recharts-curve.recharts-tooltip-cursor]:stroke-[#80808080] [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer_path]:[fill-opacity:1] [&_.recharts-layer_path]:[stroke-width:2] [&_.recharts-layer_path]:[stroke:var(--color-border)] [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-black [&_.recharts-polar-grid_[stroke='#ccc']]:dark:stroke-white [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-black [&_.recharts-reference-line_[stroke='#ccc']]:dark:stroke-white [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-border [&_.recharts-surface]:outline-hidden",
67 className,
68 )}
69// … truncated

What it pulls in

npm packages

  • recharts

Other registry items

  • https://neobrutal-ui.andongmin.com/r/ncard.json

Files it writes

  • src/components/ui/chart.tsx

Facts

Registry
neobrutal-ui
Type
registry:ui
Access
Free
Files written
1
Licence
the repository states none
First indexed
2026-08-02
Last confirmed
2 days ago

Go to the source

Docs on neobrutal-ui neobrutal-ui.andongmin.com andongmin94/neobrutal-ui on GitHub Raw registry item This item as JSON

More from neobrutal-ui

All 100 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Accordionaccordionneobrutal-uiComponentsFree1 dep
Alertalertneobrutal-uiComponentsFreeno deps
Alert dialogalert-dialogneobrutal-uiComponentsFree1 dep
Avataravatarneobrutal-uiComponentsFree1 dep
Badgebadgeneobrutal-uiComponentsFreeno deps
Breadcrumbbreadcrumbneobrutal-uiComponentsFree1 dep
Buttonbuttonneobrutal-uiComponentsFree1 dep
Calendarcalendarneobrutal-uiComponentsFree1 dep
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