A row of narrow coloured panels that take turns opening wide, with the title rising in letter by letter. Works as a selected-work strip near the top of a portfolio.
How to use
Make two files in your project's components folder: image-strip.tsx and image-strip.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 { Fragment, useEffect, useRef, useState, type CSSProperties, type HTMLAttributes } from "react";
import styles from "./image-strip.module.css";
/** The open panel's title: letters rise into place one after another. */
function RisingTitle({ text, className, style }: { text: string; className?: string; style?: CSSProperties }) {
const words = text.trim().split(/\s+/);
// Where each word starts, counted in letters, so the rise runs on across word breaks.
const starts = words.map((_, i) => words.slice(0, i).reduce((n, word) => n + word.length + 1, 0));
return (
<span className={`${styles.title} ${className ?? ""}`} style={style}>
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 { Fragment, useEffect, useRef, useState, type CSSProperties, type HTMLAttributes } from "react";
import styles from "./image-strip.module.css";
/** The open panel's title: letters rise into place one after another. */
function RisingTitle({ text, className, style }: { text: string; className?: string; style?: CSSProperties }) {
const words = text.trim().split(/\s+/);
// Where each word starts, counted in letters, so the rise runs on across word breaks.
const starts = words.map((_, i) => words.slice(0, i).reduce((n, word) => n + word.length + 1, 0));
return (
<span className={`${styles.title} ${className ?? ""}`} style={style}>
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.