Skip to content

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

3.4 KB
Raw Blame
---
title: Thin Slab
description: "A big '1 day' contrasted with a thin progress slab labeled 14x faster than by hand"
component: thin-slab
vibe: data
length: 108
useWhen:
  - "A time-saved beat that squeezes a thick slab for the old duration down to a thin one for the new duration while the number counts across."
  - "A launch-video claim like '14x faster' where the shrinking thickness makes the gain physical."
  - "A scene that must sit over your own footage or gradient, using a transparent background."
avoidWhen:
  - "You want a bar race between several contenders on a shared clock — use `benchmark-race`."
  - "The two values should be two live stopwatches rather than a shrinking slab — use `timer-duel`."
  - "You need a single big counted number with no comparison shape — use `compact-stat`."
askedAs:
  - "14x faster than by hand"
  - "thick bar squeezed thin"
  - "I want a thick slab for the old time shrinking to a thin one for the new"
  - "time-saved beat comparing one day against minutes"
  - "show duration drastically reduced with a squeezed bar"
  - "viewer sees a big 1 day contrasted with a sliver labeled faster"
---

<ComponentPreview name="thin-slab" />

<InstallBlock name="thin-slab" />

## Usage

```tsx
// src/Root.tsx
import { Composition } from "remotion";
import { ThinSlab } from "@/components/remocn/thin-slab";

const ThinSlabScene = () => (
  <ThinSlab
    title="Time to your first launch video"
    before={{ value: 14, label: "By hand", unit: "days" }}
    after={{ value: 1, label: "With remocn", unit: "day" }}
  />
);

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

A title and the old value appear above a thick slab, then a dashed ghost of that slab holds its place while the slab squeezes to the new thickness and the number counts across. A callout such as '14x faster' fades in last, followed by a light sheen. Pass `before` and `after` as value, label and unit, and `title`; `callout` is computed unless you set it. It ships light and dark through the `theme` prop.

<PropsTable title="Props"
  rows={[
    {
      name: "title",
      type: "string",
      default: "\"Time to your first launch video\"",
      description: "Small heading above the numbers.",
    },
    {
      name: "before",
      type: "ThinSlabSide",
      default: "DEFAULT_BEFORE",
      description: "The starting side: value, label and optional unit. Drawn as the thick slab.",
    },
    {
      name: "after",
      type: "ThinSlabSide",
      default: "DEFAULT_AFTER",
      description: "The ending side: value, label and optional unit. The slab squeezes to this.",
    },
    {
      name: "callout",
      type: "string",
      description: "Text shown after the squeeze. Auto-computed from the two values if omitted.",
    },
    {
      name: "accent",
      type: "string",
      default: "\"#3B5BFD\"",
      description: "Highlight colour used in the slab and callout.",
    },
    {
      name: "background",
      type: "string",
      description: "Stage colour; pass 'transparent' to layer over other footage.",
    },
    {
      name: "speed",
      type: "number",
      default: "1",
      description: "Playback speed multiplier; 1 is the designed pace.",
    },
    {
      name: "theme",
      type: "\"dark\" | \"light\"",
      default: "\"dark\"",
      description: "Ships light and dark.",
    },
  ]}
/>