Lettering made of glass: see-through letters with a bright top edge, a fine rim and a soft glow, and a highlight that glides across with the pointer.
A headline cut into bands like a sliced print: hover and the bands slide apart in alternate directions, revealing the word in a second colour through the cut.
Customize
Usage
import { SlicedText } from "@/components/motionkit/sliced-text";
<SlicedText as="h1" text="EDITORIAL" className="text-8xl font-black tracking-tight" />Motion
The exact curves this component runs, plotted with Motion's own maths.
Bands slide
Hover
Editorial and portfolio headings, fashion and agency sites, navigation labels and big type that should reward a hover.
The word is stacked several times in the same grid cell. Each copy is clipped with clip-path to one horizontal band, so together they look like a single word. On hover each band springs sideways, alternating left and right with a small stagger, and a copy in the accent colour fades in behind them, showing through where the bands have parted. The element is labelled with the text and every copy is hidden from screen readers, so it's read once.
Works in the App Router as is. Requires Tailwind CSS v4.
One command adds the file and installs its dependencies. Needs a components.json (run npx shadcn@latest init once if you don't have one).
npx shadcn@latest add https://www.motionkitui.com/r/sliced-text.jsonnpm install motionSave as components/motionkit/sliced-text.tsx.
"use client";
import { useState, type ElementType } from "react";
import { motion, useReducedMotion } from "motion/react";
type SlicedTextProps = {
text: string;
/** Number of horizontal bands the letters are cut into. */
slices?: number;
/** How far the bands slide apart, as a share of the text's width. */
offset?: number;
/** Colour of the letters at rest. */
color?: string;
/** Colour revealed inside the cut when the bands slide. */
accent?: string;
/** The element to render, e.g. "h1". */
as?: ElementType;
className?: string;
};
/**
* A headline cut into bands like a print sliced with a scalpel. Hover and the bands slide apart in
* alternate directions, revealing the same word in a second colour through the cut, then snap back together.
*/
export function SlicedText({ text, slices = 3, offset = 0.06, color = "#F6F1E8", accent = "#5FAEB4", as: Tag = "span", className = "" }: SlicedTextProps) {
const reduceMotion = useReducedMotion();
const [open, setOpen] = useState(false);
const count = Math.max(2, Math.round(slices));
const shift = reduceMotion ? 0 : offset * 100;
return (
<Tag
aria-label={text}
onPointerEnter={() => setOpen(true)}
onPointerLeave={() => setOpen(false)}
className={`relative inline-grid cursor-default select-none whitespace-nowrap ${className}`}
>
{/* the accent copy behind, seen through the gaps as the bands slide */}
<motion.span
aria-hidden
className="col-start-1 row-start-1"
style={{ color: accent }}
initial={false}
animate={{ opacity: open ? 1 : 0, scaleX: open ? 1 : 0.92 }}
transition={{ duration: reduceMotion ? 0 : 0.35 }}
>
{text}
</motion.span>
{Array.from({ length: count }, (_, index) => {
const top = (index / count) * 100;
const bottom = 100 - ((index + 1) / count) * 100;
const direction = index % 2 === 0 ? -1 : 1;
return (
<motion.span
key={index}
aria-hidden
className="col-start-1 row-start-1"
// neighbouring bands overlap by a pixel, so no hairline shows between them at rest
style={{ color, clipPath: `inset(calc(${top}% - 1px) -20% calc(${bottom}% - 1px) -20%)` }}
initial={false}
animate={{ x: open ? `${direction * shift}%` : "0%", opacity: open ? 0.92 : 1 }}
transition={reduceMotion ? { duration: 0 } : { type: "spring", stiffness: 320, damping: 24, delay: open ? index * 0.03 : (count - index) * 0.02 }}
>
{text}
</motion.span>
);
})}
</Tag>
);
}
| Prop | Type | Default | Description |
|---|---|---|---|
| text | string | — | The word or line. |
| slices | number | 3 | Number of horizontal bands. |
| offset | number | 0.06 | How far the bands slide, as a share of the width. |
| color | string | "#F6F1E8" | Colour at rest. |
| accent | string | "#5FAEB4" | Colour revealed through the cut. |
| as | ElementType | "span" | Element to render, e.g. h1. |
How we audit: the WCAG 2.2 animation checklist and respecting reduced motion in React.
Yes. The file starts with "use client", so you can import it straight into a Server Component page or layout. It works in Vite as is, and in Astro as a React island.
Only the motion package, beside React and Tailwind CSS v4. There is no MotionKit package and no Tailwind config to add.
Yes. Run npx shadcn@latest add https://www.motionkitui.com/r/sliced-text.json in any project with a components.json. It saves the file to components/motionkit and installs its dependencies.
With reduced motion on, the bands stay together and only the colour changes.
Lettering made of glass: see-through letters with a bright top edge, a fine rim and a soft glow, and a highlight that glides across with the pointer.
Crisp letters lit from behind by a soft, slowly flowing glow of colour, the way a new AI feature or a launch headline glows.
A headline that resolves like an image loading: it arrives as a few big blocks of colour, and each step halves the pixels until the letters snap sharp.