Installation

pnpm add fetta
bun add fetta
npm install fetta
yarn add fetta

Quick Start

React

App.tsx
import { SplitText } from 'fetta/react';
import { animate, stagger } from 'motion';

<SplitText
  onSplit={({ chars }) => {
    animate(chars, { opacity: [0, 1] }, { delay: stagger(0.02) });
  }}
>
  <h1>Hello world</h1>
</SplitText>

Vanilla JavaScript

main.ts
import { splitText } from 'fetta';

const { chars } = splitText(document.querySelector('h1'));
// Animate with any library

On this page