Basic animated chart with default styling. Toggle between datasets to see the animation.
<AnimatedChart columns={[ { title: "TV", value: 13.9, appendString: "h/wk", animationDelay: 0 }, { title: "Social Media", value: 13.1, animationDelay: 0.3 }, // ... more columns ]} maxValue={15} restartOnDataChange={true}/>For charts where values can reach maximum, labels can be repositioned to avoid overlapping with the column bars.
<AnimatedChart titleClassName="relative -top-10" columns={[ { title: "Gaming", value: 100, appendString: "%" }, { title: "Online Video", value: 86 }, // ... more columns ]} maxValue={100} restartOnDataChange={true}/>Customize colors per column using className props for titles, values, bars, and borders.
<AnimatedChart columns={[ { title: "TV", value: 12, appendString: "h/wk", className: "bg-blue-500/10", titleClassName: "text-blue-500", valueClassName: "text-blue-500", topBorderClassName: "border-blue-500/50", }, { title: "Mobile Games", value: 8, appendString: "h/wk", className: "bg-pink-500/10", titleClassName: "text-pink-500", valueClassName: "text-pink-500", topBorderClassName: "border-pink-500", }, // ... more columns ]} maxValue={15} restartOnDataChange={true}/>restartOnDataChange propcolumns - ColumnData[] (required) - Array of column datamaxValue - number (required) - Maximum value for scaling column heightstitleClassName - string - Global className for all column titlesvalueClassName - string - Global className for all column valuesrestartOnDataChange - boolean - When true, columns animate from zero whenever data changes (default: false)className - string - Additional classes for the containertitle - string (required) - Column title displayed at the topvalue - number (required) - The numeric value for this columnprependString - string - String to prepend before the value (e.g., "$")appendString - string - String to append after the value (e.g., "%", "h/wk")animationDuration - number - Animation duration in seconds (default: 1)animationDelay - number - Animation delay in seconds (default: 0)className - string - ClassName for the animated column bartopBorderClassName - string - ClassName for the column's top bordertitleClassName - string - ClassName for this column's title (overrides global)valueClassName - string - ClassName for this column's value (overrides global)