Point at a letter and it parts at the middle, with its neighbours opening a little less. Suits a large name or section title.
How to use
Make two files in your project's components folder: split-letters.tsx and split-letters.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 { useRef, useState, type CSSProperties } from "react";
import styles from "./split-letters.module.css";
/** How far each half moves, in em so it scales with the type: the letter under the pointer, its neighbours, then the next pair out. */
const SPREAD = ["0.16em", "0.1em", "0.035em"];
function offsetFor(index: number, active: number | undefined) {
if (active === undefined) return null;
const distance = Math.abs(index - active);
return SPREAD[distance] ?? null;
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 { useRef, useState, type CSSProperties } from "react";
import styles from "./split-letters.module.css";
/** How far each half moves, in em so it scales with the type: the letter under the pointer, its neighbours, then the next pair out. */
const SPREAD = ["0.16em", "0.1em", "0.035em"];
function offsetFor(index: number, active: number | undefined) {
if (active === undefined) return null;
const distance = Math.abs(index - active);
return SPREAD[distance] ?? null;
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.