Skip to content
Components

Text Reveal

Text Reveal brings controlled expression to your interface.

Open ↗

Make it yours.

Install the editable source and its dependencies into your React + Tailwind project.

Scroll horizontally for long lines
pnpm dlx shadcn@4.0.8 add http://localhost:3000/r/text-reveal.json

Use it

Scroll horizontally for long lines
"use client";
import {TextReveal} from '@/components/jez-ui/ui/text-reveal';

export default function Example(){

return <><div className="w-full rounded-xl bg-accent px-7 py-14 text-foreground md:px-12 md:py-20"><TextReveal className="block max-w-xl font-display text-5xl font-medium leading-[1.03] tracking-tight md:text-7xl">Less noise. More feeling.</TextReveal><p className="mt-8 text-sm">A new perspective, one word at a time.</p></div></>;
}

Props & types

Scroll horizontally for long lines
{
  children: string;
  className?: string;
}

Source

View 2 source files

registry/ui/text-reveal.tsx

Scroll horizontally for long lines
"use client";
import * as React from "react";
import { cn } from "./utils";
import { motion, useReducedMotion } from "motion/react";
export function TextReveal({
  children,
  className,
}: {
  children: string;
  className?: string;
}) {
  const reduce = useReducedMotion();
  return (
    <motion.span
      initial={reduce ? false : { clipPath: "inset(0 0 100% 0)" }}
      whileInView={{ clipPath: "inset(0 0 0% 0)" }}
      viewport={{ once: true }}
      transition={{ duration: 0.65, ease: [0.16, 1, 0.3, 1] }}
      className={cn("inline-block", className)}
    >
      {children}
    </motion.span>
  );
}

registry/ui/utils.ts

Scroll horizontally for long lines
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...values: ClassValue[]) {
  return twMerge(clsx(values));
}

Dependencies

motion@13.2.0 · clsx@2.1.1 · tailwind-merge@3.5.0

Accessibility & behaviour

Respect reduced-motion preferences. Decorative effects must not carry essential information. WebGL scenes include a static fallback and only render while visible.

Read the accessibility and performance guide →