# Split Text

> The workhorse: letters or words in, with an effect and an order.

Rise, drop, spin, pop, skew or swing; from the start, end, centre or at random. Spring-driven so the line feels physical.

- Family: Typography
- Plan: Creative. Included with Creative.
- Requires: React, Tailwind CSS v4 and the motion package
- Page with a live preview: https://galactrex.com/ui/split-text/
- Licence: https://galactrex.com/ui/license/

## Install

```sh
npx @galactrex/ui login   # once, with an API key from https://galactrex.com/account/
npx @galactrex/ui add split-text
```

It installs to `components/galactrex/split-text.tsx`, with the shared motion helpers beside it. First time in a project: `npx @galactrex/ui init` (setup guide: https://galactrex.com/docs/ui-components-setup/).

## Usage

```tsx
import { SplitText } from "@/components/galactrex/split-text";

<SplitText text="Launch week" effect="pop" order="center" />
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `text` | `string` | — | The text. |
| `as` | `ElementType` | `"h2"` | Element. |
| `by` | `"word" \| "char"` | `"char"` | Pieces. |
| `effect` | `"rise" \| "drop" \| "spin" \| "pop" \| "skew" \| "swing"` | `"rise"` | Entrance. |
| `trigger` | `"mount" \| "inView" \| "hover" \| "manual"` | `"inView"` | When it plays. |
| `active` | `boolean` | — | Plays when true, for trigger="manual". |
| `stagger` | `number` | `0.025` | Seconds between pieces. |
| `order` | `"start" \| "end" \| "center" \| "random"` | `"start"` | Stagger order. |
| `className` | `string` | — | Extra classes for the outer element. |

## Variants

- **Six effects.** Each with four orders.

## Accessibility

- Real text read once.

## Motion

- Spring transforms per piece.
- Reduced motion: shown at once.
