# Sliding Text

> Letters roll over on hover like a rolling sign.

Every letter slides out and an identical one slides in behind it, one after another. For links, nav items and buttons.

- 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/sliding-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 sliding-text
```

It installs to `components/galactrex/sliding-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 { SlidingText } from "@/components/galactrex/sliding-text";

<a href="/work/"><SlidingText text="Work" /></a>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `text` | `string` | — | The text. |
| `as` | `ElementType` | `"span"` | Element. |
| `trigger` | `"mount" \| "inView" \| "hover" \| "manual"` | `"hover"` | When it plays. |
| `active` | `boolean` | — | Plays when true, for trigger="manual". |
| `stagger` | `number` | `0.018` | Seconds between letters. |
| `direction` | `"up" \| "down"` | `"up"` | Travel. |
| `className` | `string` | — | Extra classes for the outer element. |

## Variants

- **Nav link.** Hover roll on menu items.
- **Entrance.** Any other trigger rolls it in once.

## Accessibility

- Real text read once.

## Motion

- Transforms inside clipped letter slots.
- Reduced motion: no roll.
