Skip to content

Production-ready animations, transitions, backgrounds, and scenes for Remotion

3.1 KB
Raw Blame
---
title: Animated Bar Chart
description: Bars spring up from the baseline with a staggered cascade
component: animated-bar-chart
vibe: data
length: 90
useWhen:
  - "Showing comparative categorical metrics in a product demo — feature usage, plan distribution, benchmark scores."
  - "A business KPI or results slide needs a \"data revealed\" moment rather than a static screenshot."
  - "The dataset has a clear winner bar to build to (stagger naturally draws attention to the tallest last)."
avoidWhen:
  - "The data represents change over time — continuous trends belong in `animated-line-chart`, not bars."
  - "You have a single data point; one bar springing up looks degenerate — embed a number counter or use a text animation."
askedAs:
  - "bar chart growing"
  - "bars rising from the baseline"
  - "I want a bar graph that animates in with staggered columns"
  - "compare categories visually with columns jumping up"
  - "show quarterly revenue or metrics as springing vertical bars"
  - "data slide where the viewer sees which category is tallest"
---

<ComponentPreview name="animated-bar-chart" />

<InstallBlock name="animated-bar-chart" />

## Usage

```tsx
// src/Root.tsx
import { Composition } from "remotion";
import { AnimatedBarChart } from "@/components/remocn/animated-bar-chart";

const AnimatedBarChartScene = () => (
  <AnimatedBarChart
    data={[35, 60, 45, 80, 55, 70, 90, 65]}
    barColor="#0ea5e9"
  />
);

export const RemotionRoot = () => (
  <Composition
    id="AnimatedBarChart"
    component={AnimatedBarChartScene}
    durationInFrames={90}
    fps={30}
    width={1280}
    height={720}
  />
);
```

### With Backdrop

Renders transparent — supply the background via `Backdrop`:

```tsx
import { Backdrop } from "@/components/remocn/backdrop";
import { AnimatedBarChart } from "@/components/remocn/animated-bar-chart";

<Backdrop fill={{ type: "color", value: "#0a0a0a" }}>
  <AnimatedBarChart data={[35, 60, 45, 80, 55, 70, 90, 65]} barColor="#0ea5e9" />
</Backdrop>
```

<PropsTable title="Props"
  rows={[
    {
      name: "data",
      type: "number[]",
      default: "[35, 60, 45, 80, 55, 70, 90, 65]",
      description: "Bar values. Auto-scaled to the available height.",
    },
    {
      name: "labels",
      type: "string[]",
      description: "Optional labels rendered under each bar",
    },
    {
      name: "width",
      type: "number",
      default: "1000",
      description: "SVG viewBox width",
    },
    {
      name: "height",
      type: "number",
      default: "500",
      description: "SVG viewBox height",
    },
    {
      name: "barColor",
      type: "string",
      default: "\"#0ea5e9\"",
      description: "Fill color used for every bar",
    },
    {
      name: "gap",
      type: "number",
      default: "16",
      description: "Pixel gap between bars",
    },
    {
      name: "staggerFrames",
      type: "number",
      default: "6",
      description: "Frame delay applied to each successive bar",
    },
    {
      name: "className",
      type: "string",
      description: "Optional className passed to the outer container",
    },
  ]}
/>