Updated
Line-by-line Rise
Customize
Duration0.45s
Stagger0.08s
Text size48px
Installation
npx shadcn@latest add https://uibrik.com/r/line-rise.jsonInstall the packages
npm install @chenglou/pretext motionCopy the source into your project
components/uibrik/line-rise/line-rise.tsx"use client"; import { layoutWithLines, prepareWithSegments } from "@chenglou/pretext"; import { motion } from "motion/react"; import { useEffect, useRef, useState } from "react"; // `play` counts presses of a card's Change button. 0 means the card has not // been pressed yet, so every effect renders its resting state without // animating on page load. export type EffectProps = { play: number }; // Size comes from --text-effect-size (default 1.25rem, i.e. text-xl), so a // preview can enlarge every effect without changing the installed default. const SIZE = "text-[length:var(--text-effect-size,1.25rem)] leading-[1.4]"; const TEXT = `${SIZE} text-zinc-700 font-medium dark:text-zinc-200`; const EASE_OUT = [0.23, 1, 0.32, 1] as const; // 04 — A paragraph rises line by line from behind a clip. Pretext breaks the // lines exactly as the browser would, so each line gets its own mask. // Width and line height scale with the type: 260px and 28px at 20px text. const MASK_WIDTH_EM = 13; const MASK_LINE_EM = 1.4;
Adds the files to
components/uibrik/line-rise and installs @chenglou/pretext and motion. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/line-rise.Usage
import { LineRise } from "@/components/uibrik/line-rise/line-rise";const text = "Good interfaces reveal themselves one line at a time.";<LineRise play={0} text={text} duration={0.45} stagger={0.08}/>Where to use Line-by-line Rise
Long hero taglines
Each wrapped line rising in turn keeps a two- or three-line headline readable as it enters.
Section intros
Line-by-line entrances give paragraph-length intros rhythm on scroll.
Pairs with Fade In Left to Right
Editorial openings
Rising lines suit articles and blog posts that open with a statement.
Props
LineRise- text
- Type string
- "Good interfaces reveal themselves one line at a time."
- The copy to animate.
- duration
- Type number
- 0.45
- Time for each line to rise.
- stagger
- Type number
- 0.08
- Delay between lines.
- playrequired
- Type number
- –
- Each change plays the effect again; 0 shows its resting state.