recharts-bar-chart
evilcharts/recharts-bar-chartFreeComponent
Bar chart component
Install it
npx shadcn@latest add https://evilcharts.com/r/recharts-bar-chart.jsonSource
1"use client";23import {4 Bar as RechartsBar,5 BarChart as RechartsBarChart,6 CartesianGrid,7 Rectangle,8 ReferenceLine,9 XAxis as RechartsXAxis,10 YAxis as RechartsYAxis,11} from "recharts";12import {13 Children,14 createContext,15 isValidElement,16 use,17 useCallback,18 useId,19 useMemo,20 useRef,21 useState,22 type ComponentProps,23 type ReactNode,24} from "react";25import {26 type ChartConfig,27 ChartContainer,28 getColorsCount,29 getLoadingData,30 LoadingIndicator,31} from "@/registry/ui/recharts-chart";32import {33 ChartTooltip,34 ChartTooltipContent,35 type TooltipRoundness,36 type TooltipVariant,37} from "@/registry/ui/recharts-tooltip";38import { ChartLegend, ChartLegendContent, type ChartLegendVariant } from "@/registry/ui/recharts-legend";39import { Brush, EvilBrush, useEvilBrush, type BrushProps, type EvilBrushRange } from "@/registry/ui/recharts-brush";40import { ChartBackground, type BackgroundVariant } from "@/registry/ui/recharts-background";41import { RectRadius } from "recharts/types/shape/Rectangle";42import { motion, useReducedMotion } from "motion/react";4344// Constants45const DEFAULT_BAR_RADIUS = 2;46const LOADING_BAR_DATA_KEY = "loading";47const LOADING_ANIMATION_DURATION = 2000; // in milliseconds48const STACK_ID = "evil-stacked";49const BAR_GROW_DURATION = 0.5; // per-bar grow-in length, in seconds50const BAR_STAGGER = 0.05; // delay between consecutive bars, in seconds51const REVEAL_EASE: [number, number, number, number] = [0, 0.7, 0.5, 1]; // grow-in easing5253type BarVariant = "default" | "hatched" | "duotone" | "duotone-reverse" | "gradient" | "stripped";54type StackType = "default" | "stacked" | "percent";55type BarLayout = "vertical" | "horizontal";5657/**58 * Order in which bars grow into view. Recharts' own bar animation is permanently59 * disabled — every bar instead grows from its baseline (bottom for vertical60 * layout, left for horizontal), and this controls the stagger sequence.61 *62 * NOTE: the grow-in is a per-frame animation, so it is heavier than a static63 * chart. `"none"` opts out entirely; it is also what a device with the OS64 * "reduce motion" preference falls back to automatically.65 */66type BarAnimationType = "none" | "left-to-right" | "right-to-left" | "center-out" | "edges-in";6768// ─────────────────────────────────────────────────────────────────────────────69// Shared context70// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from EvilCharts
All 271 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| echarts-area-chartecharts-area-chart | EvilCharts | Components | Free | 2 deps | |
| echarts-bar-chartecharts-bar-chart | EvilCharts | Components | Free | 2 deps | |
| echarts-brushecharts-brush | EvilCharts | Components | Free | 1 dep | |
| echarts-chartecharts-chart | EvilCharts | Components | Free | 1 dep | |
| echarts-composed-chartecharts-composed-chart | EvilCharts | Components | Free | 2 deps | |
| echarts-dotecharts-dot | EvilCharts | Components | Free | 1 dep | |
| echarts-legendecharts-legend | EvilCharts | Components | Free | no deps | |
| echarts-line-chartecharts-line-chart | EvilCharts | Components | Free | 2 deps |
