Select Replace

A phrase is selected like text in an editor, deleted, and replaced with new styled words. A free, MIT-licensed Remotion text animation.

Installation
$ pnpm dlx shadcn@latest add @remocn/select-replace

Usage

tsx
// src/Root.tsx
import { Composition } from "remotion";
import { SelectReplace } from "@/components/remocn/select-replace";
 
const SelectReplaceScene = () => (
  <SelectReplace text="Draft it next week." edits={[{ from: "Draft", to: "Ship" }, { from: "next week", to: "tonight" }]} />
);
 
export const RemotionRoot = () => (
  <Composition
    id="SelectReplace"
    component={SelectReplaceScene}
    durationInFrames={340}
    fps={60}
    width={1280}
    height={720}
  />
);

The text shows, then each edits item selects a from phrase and swaps in its to replacement with a highlight. Pass text and edits with the phrases you want changed. It ships in light and dark through the theme prop.

Props12

PropTypeDefault
text
string"Draft it next week."

Starting sentence containing every `from` phrase.

edits
SelectReplaceEdit[]—

List of `{ from, to }` replacements applied in order.

hold
number9

Frames the selection holds before it is typed over.

fontWeight
number500

Weight of the line; typed words stay in the italic serif.

accent
string"#3B5BFD"

Accent color override; falls back to the theme accent.

ink
string—

Text color; overrides the theme ink.

background
string—

Background fill; pass "transparent" to drop it.

fontFamily
string"Geist"

Typeface for the line; typed words keep the italic serif. Load the font in your project first.

scale
number1

Size of the foreground around the frame's center; the background stays put.

delay
number0

Frames to hold the first frame before anything moves.

theme
"dark" | "light""dark"

Ships light and dark; picks the palette.

speed
number1

Playback speed multiplier for the whole timeline.

  • textstring

    Starting sentence containing every `from` phrase.

    Default"Draft it next week."

  • editsSelectReplaceEdit[]

    List of `{ from, to }` replacements applied in order.

  • holdnumber

    Frames the selection holds before it is typed over.

    Default9

  • fontWeightnumber

    Weight of the line; typed words stay in the italic serif.

    Default500

  • accentstring

    Accent color override; falls back to the theme accent.

    Default"#3B5BFD"

  • inkstring

    Text color; overrides the theme ink.

  • backgroundstring

    Background fill; pass "transparent" to drop it.

  • fontFamilystring

    Typeface for the line; typed words keep the italic serif. Load the font in your project first.

    Default"Geist"

  • scalenumber

    Size of the foreground around the frame's center; the background stays put.

    Default1

  • delaynumber

    Frames to hold the first frame before anything moves.

    Default0

  • theme"dark" | "light"

    Ships light and dark; picks the palette.

    Default"dark"

  • speednumber

    Playback speed multiplier for the whole timeline.

    Default1