Skip to content
العربية
Motion

RevealText

A heading whose words rise out of a mask once, when on screen, line after line. Words are never split, so Arabic letters stay joined. Screen readers read the text once. A fade with reduced motion. The children are one plain string (no elements).

import { RevealText } from "@percentsa/motion";

Examples

We design, build and run software for companies in Saudi Arabia.

Code
export function RevealTextExample() {
  const t = useT();
  const [key, setKey] = useState(0);
  return (
    <Stack gap={6} className="w-full max-w-2xl">
      <RevealText key={key} as="h2" className="display text-5xl">
        {t("We design, build and run software for companies in Saudi Arabia.", "نصمّم البرمجيات ونبنيها ونشغّلها للشركات في السعودية.")}
      </RevealText>
      <Button variant="secondary" size="sm" className="w-fit" onClick={() => setKey(key + 1)}>
        {t("Replay", "أعد التشغيل")}
      </Button>
    </Stack>
  );
}