Column Reflow
Justified paragraph whose column width animates while the lines reflow with even word spacing. A responsive, editorial typography demo for layout and publishing tools. A free, MIT-licensed Remotion text animation.
In Remotion, Column Reflow animates a justified paragraph as its column width changes: words glide to their new lines and the word spacing is redistributed evenly, ending with one accent word in italic. Use it to illustrate responsive layout, editorial typography or a publishing tool.
$ pnpm dlx shadcn@latest add @remocn/column-reflowHow to build this in Remotion
No need for a Knuth-Plass library, text-wrap: pretty or fitText. Install the component and pass your paragraph:
npx shadcn@latest add @remocn/column-reflowThe line breaking is done in timeline.ts with a built-in optimal-fit breaker and Newsreader glyph metrics, so both the narrow and the wide column are fully justified. Rows then slide sideways and close up vertically with interpolate() over an Easing curve, so no word crosses another. Nothing is measured in the browser, so it doesn't use delayRender or @remotion/layout-utils.
Good to know
- Length: 90 frames of motion at 30 fps (180 at 60 fps) with the default props. The demo composition plays 120 frames, which adds a hold. Longer text adds rows and takes a little longer to settle. The Usage example below is a 60 fps composition, so the numbers it hands to Remotion are doubled, see Frame rate.
- Installs:
remotion,@remotion/google-fontsfrom npm, plus the remocn helpersglide,frame-rate,timeline. The shadcn CLI copies the source into your project. - Font: loads Newsreader (roman and italic) itself through
@remotion/google-fonts. The line breaks use built-in Newsreader metrics, so anotherfontFamilycan leave justified lines slightly off. - Width:
measuresets the narrow column in ems (9.6 by default). The wide column is about two narrow lines side by side;directionpicks"widen"(narrow to wide) or"narrow". There is no separate prop for the wide width. - There is no duration or easing prop; use
speedanddelay.
Usage
// src/Root.tsx
import { Composition } from "remotion";
import { ColumnReflow } from "@/components/remocn/column-reflow";
const ColumnReflowScene = () => <ColumnReflow text="Good motion starts with good typography." accentWord="typography" direction="widen" />;
export const RemotionRoot = () => (
<Composition
id="ColumnReflow"
component={ColumnReflowScene}
durationInFrames={240}
fps={60}
width={1280}
height={720}
/>
);A justified serif paragraph sits in a column, then the column widens (or narrows) while words glide to new lines and the spacing is redistributed evenly, ending with one accent word in italic. Pass text, accentWord and direction.
Props13
| Prop | Type | Default |
|---|---|---|
| text | stringDEFAULT_TEXT The paragraph to set and reflow. | |
| accentWord | string"room" Word set in accent color and italic. | |
| direction | "widen" | "narrow""widen" Whether the column starts narrow and widens, or the reverse. | |
| measure | number9.6 Width of the narrow column, in ems of the type. | |
| theme | "dark" | "light""dark" Color scheme; ships dark and light. | |
| fontFamily | string"Newsreader" Typeface for the copy. Newsreader loads by default; load any other face 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. | |
| grain | booleantrue Film grain over the scene. | |
| speed | number1 Playback multiplier for the whole timeline. | |
| accent | string— Accepted for parity with the other pieces; not used. The accent word is set apart by its italic serif, not by color. | |
| ink | string— Text color; overrides the theme ink. | |
| background | string— Background fill; pass "transparent" to drop it. | |
- textstring
The paragraph to set and reflow.
Default
DEFAULT_TEXT - accentWordstring
Word set in accent color and italic.
Default
"room" - direction"widen" | "narrow"
Whether the column starts narrow and widens, or the reverse.
Default
"widen" - measurenumber
Width of the narrow column, in ems of the type.
Default
9.6 - theme"dark" | "light"
Color scheme; ships dark and light.
Default
"dark" - fontFamilystring
Typeface for the copy. Newsreader loads by default; load any other face in your project first.
Default
"Newsreader" - scalenumber
Size of the foreground around the frame's center; the background stays put.
Default
1 - delaynumber
Frames to hold the first frame before anything moves.
Default
0 - grainboolean
Film grain over the scene.
Default
true - speednumber
Playback multiplier for the whole timeline.
Default
1 - accentstring
Accepted for parity with the other pieces; not used. The accent word is set apart by its italic serif, not by color.
- inkstring
Text color; overrides the theme ink.
- backgroundstring
Background fill; pass "transparent" to drop it.
Common questions
How do I animate a justified paragraph so the column width changes and the lines reflow?
Install Column Reflow with npx shadcn@latest add @remocn/column-reflow, pass text and choose direction. The paragraph reflows between a narrow and a wide justified column.
Can I set the start and end widths?
Only the narrow one, through measure in ems. The wide column is derived from it.
Do I need a justification library?
No. The component breaks the lines itself and installs only remotion and @remotion/google-fonts.
Related effects
- Soft Blur In: a short punchy headline instead of a paragraph.
- Tagline Justify: a tagline springs into a justified block.
- Whole Page: manifesto paragraphs fill a page in columns.
- Cursor Frame: a selection box resizes a headline and it rewraps.