RemotionUI

Comparison Bars

Two-series before/after with delta callout. Install with npx remotion-ui@latest add comparison-bars.

PrimitiveData & media

comparison-bars30fps · 960×540
Install
$ npx remotion-ui@latest add comparison-bars

Before-and-after pairs, with the percentage change called out beside each one.

import { ComparisonBars } from "@/remotion/primitives/comparison-bars";

<ComparisonBars
  rows={[
    { label: "Time to first cut", before: 240, after: 96 },
    { label: "Renders / week", before: 120, after: 310 },
  ]}
  seriesLabels={["Before", "After"]}
  staggerInFrames={18}
/>

One scale for every row

Both bars in every pair are measured against the largest value in the whole set. Scaling each row to itself is what makes a small category look like it beat a large one — the pairs have to stay comparable to each other, not only internally.

The pair reads as a change

The second bar trails the first by pairOffsetInFrames. That short gap is what makes the two bars read as one movement rather than as neighbours that happen to be adjacent, and it is brief enough that both are still growing at once.

The figure inside the coloured bar waits until the bar is wide enough to hold it, and the delta chip waits until the bar has stopped — it is the conclusion of the pair, so it cannot arrive first.

Deltas

delta is computed from before and after unless you pass your own string. A rise takes afterColor, a fall takes downColor; when a fall is the good outcome — render times, error counts — pass delta explicitly to say so.

Every bar is measured against the largest value in the whole set, so pairs stay comparable to each other and not only internally. The second bar trails the first by a few frames, which is what makes a pair read as one change rather than two adjacent bars.

Agent notes

Install first, then import the copied source component locally. AI guide →

Import
@/remotion/primitives/comparison-bars
  • Use when: frame-level motion primitives and reusable animation wrappers.
  • Customize: rows, width, rowHeight, gap, plus copied source for timing, layout, colors, and typography.
  • Rule: do not import this component from the remotion-ui npm package; it is copied into your project.

Usage

Example
import { ComparisonBars } from "@/remotion/primitives/comparison-bars"; <ComparisonBars rows={[ { label: "Time to first cut", before: 240, after: 96 }, { label: "Renders / week", before: 120, after: 310 }, ]} seriesLabels={["Before", "After"]} staggerInFrames={18} />

API Reference

PropTypeDescription
rowsComparisonRowDatum[]`{ label, before, after, delta? }`. The delta is computed when omitted.
widthnumberOverall width, label column included.
rowHeightnumberHeight of one pair, both bars and their gap included.
gapnumberSpace between rows.
labelWidthnumberWidth reserved for the row labels.
beforeColorstringBaseline bar. Muted on purpose — it is the thing being beaten.
afterColorstringNew-value bar, and the colour of a rising delta.
downColorstringDelta colour when the change is a fall.
seriesLabels[string, string]Legend above the rows, e.g. `["Before", "After"]`.
showDeltabooleanPercentage-change chip at the end of the second bar.
durationInFramesnumberLength of one bar's growth.
staggerInFramesnumberFrames between one row and the next.
pairOffsetInFramesnumberFrames the second bar trails the first by.
exitAtInFramesnumberFrame the rows start leaving on, in arrival order.
framenumberFrame override — pass the parent frame inside a `<Sequence>`.

Related

On this page