A paragraph stays pinned while you scroll and each word turns from faint to full. Made for the one statement on your about page.
How to use
Make two files in your project's components folder: scroll-text-reveal.tsx and scroll-text-reveal.module.css.
Paste the code into each one, keeping the licence note at the top of the component.
It needs nothing beyond React. Your project needs CSS Modules, which Next.js and Vite already have.
Import it where you want it, then change the words, colours and sizes to yours.
The code
"use client";
import { useEffect, useRef, useSyncExternalStore, type CSSProperties, type RefObject } from "react";
import styles from "./scroll-text-reveal.module.css";
export interface TextRevealProps {
/** The paragraph. Each word lights up in turn. */
children: string;
className?: string;
/** Classes for the text: size, padding. Leave out for a size that grows with the screen. */
textClassName?: string;
/** Colour of the lit words. */
This comes with paid plans
The code for every component comes with paid plans, along with the rest of the AI toolkit. The first component under each heading is free.
"use client";
import { useEffect, useRef, useSyncExternalStore, type CSSProperties, type RefObject } from "react";
import styles from "./scroll-text-reveal.module.css";
export interface TextRevealProps {
/** The paragraph. Each word lights up in turn. */
children: string;
className?: string;
/** Classes for the text: size, padding. Leave out for a size that grows with the screen. */
textClassName?: string;
/** Colour of the lit words. */
This comes with paid plans
The code for every component comes with paid plans, along with the rest of the AI toolkit. The first component under each heading is free.