Components
Text effect
NativeCopy that types, scrambles, rotates through words, rises word by word or letter by letter, sharpens from a blur, slides in, gets a marker sweep, shimmers, waves or drops in.
Installation
npx nook-ui@latest add text-effectPrompt
Paste this into your AI coding assistant. It adds this exact component, the same way the CLI does, and tells the assistant how to use it.
Short. For assistants that can run commands in your project.
Add the Nook "Text effect" component to this project, exactly as Nook ships it.
Copy that types, scrambles, rotates through words, rises word by word or letter by letter, sharpens from a blur, slides in, gets a marker sweep, shimmers, waves or drops in.
Steps
1. Check for `nook.json` in the project root. If it is missing, run `npx nook-ui@latest init` first (React or Next.js with Tailwind CSS v4). It adds the Nook tokens, the theme and `cn()`.
2. Run `npx nook-ui@latest add text-effect`. It writes `components/ui/text-effect.tsx` together with everything the component needs. Do not write the component from memory.
3. If you cannot run commands, fetch http://localhost:3000/r/text-effect.json, write every entry of `files` to the path it names, install the packages in `dependencies`, and repeat for each name in `registryDependencies`.
4. Use it where I ask. Start from this example:
```tsx
import { TextEffect } from "@/components/ui/text-effect";
export default function TextEffectDefault() {
return <div className="grid w-full gap-6 sm:grid-cols-2">{([['typewriter', 'Make room for good work.'], ['scramble', 'Your next chapter starts here.'], ['rotate', 'Built for thoughtful teams.'], ['gradient', 'Everything in its place.']] as const).map(([variant,text]) => <TextEffect key={variant} text={text} variant={variant} words={variant === 'rotate' ? ['Made for a calmer day.', 'Ready when you are.'] : undefined} />)}</div>;
}
```
API
- `TextEffect`: Copy that types, scrambles, rotates through words or sweeps with a brand gradient.
- `text` (`string`): Full primary text, always in the accessibility tree.
- `words` (`string[]`): Additional phrases for the rotate variant.
- `variant` (`typewriter | scramble | rotate | gradient | fade-up | letters | blur | slide | marker | shimmer | wave | drop`): Visual treatment, started with the playback button. Fade-up, letters, blur, slide, marker and drop play once. Shimmer and wave keep going until paused.
- Variant `variant`: typewriter, scramble, rotate, gradient (default typewriter)
Rules
- Colors, radii, shadows and motion come from Nook tokens and classes such as `bg-primary`, `text-muted-foreground`, `border-border`, `rounded-lg` and `h-control`. Never hard-code them.
- Do not restyle or simplify the file. Change how it looks through `className`, its props and the theme.
- It must keep working with the keyboard, in light and dark mode, and in the sharp, soft and bold styles.
- Accessibility: Full phrases remain in a static text alternative. A visible control starts or pauses motion. Reduced motion shows the full primary phrase.
Done when the component renders like the example in light and dark mode and the project type-checks.Usage
import { TextEffect } from "@/components/ui/text-effect";
export default function TextEffectDefault() {
return <div className="grid w-full gap-6 sm:grid-cols-2">{([['typewriter', 'Make room for good work.'], ['scramble', 'Your next chapter starts here.'], ['rotate', 'Built for thoughtful teams.'], ['gradient', 'Everything in its place.']] as const).map(([variant,text]) => <TextEffect key={variant} text={text} variant={variant} words={variant === 'rotate' ? ['Made for a calmer day.', 'Ready when you are.'] : undefined} />)}</div>;
}Examples
Rotating words
Gradient text
Words rise one by one
Each word fades up 0.6em, 55 ms after the last.
Each word fades up 0.6em, 55 ms after the last. Press Play to run it. With reduced motion the full line is shown at once.
Letters rise in a stagger
Each letter fades up in turn.
Each letter fades up in turn. Press Play to run it. With reduced motion the full line is shown at once.
Focus in from a blur
The whole line sharpens from a 0.4em blur.
The whole line sharpens from a 0.4em blur. Press Play to run it. With reduced motion the full line is shown at once.
Words slide in from the left
Each word slides in 1.2em from the left.
Each word slides in 1.2em from the left. Press Play to run it. With reduced motion the full line is shown at once.
A highlighter sweeps behind the words
A brand colored marker draws itself under the text.
A brand colored marker draws itself under the text. Press Play to run it. With reduced motion the full line is shown at once.
A light sweeps across the text
A band of brand color travels across until you pause it.
A band of brand color travels across until you pause it. Press Play to run it. With reduced motion the full line is shown at once.
Letters bob in a wave
Each letter lifts in turn, forever, until you pause.
Each letter lifts in turn, forever, until you pause. Press Play to run it. With reduced motion the full line is shown at once.
Letters drop in and settle
Each letter drops from above and settles with a small bounce.
Each letter drops from above and settles with a small bounce. Press Play to run it. With reduced motion the full line is shown at once.
Variants
Defined in one place with cva, at the top of the component file.
variant
typewriter (default)scramblerotategradient
Props
TextEffect
Copy that types, scrambles, rotates through words or sweeps with a brand gradient.
| Prop | Type | Default | Description |
|---|---|---|---|
| text | string | – | Full primary text, always in the accessibility tree. |
| words | string[] | – | Additional phrases for the rotate variant. |
| variant | typewriter | scramble | rotate | gradient | fade-up | letters | blur | slide | marker | shimmer | wave | drop | – | Visual treatment, started with the playback button. Fade-up, letters, blur, slide, marker and drop play once. Shimmer and wave keep going until paused. |
Accessibility
Full phrases remain in a static text alternative. A visible control starts or pauses motion. Reduced motion shows the full primary phrase.
Checked against WCAG 2.1 AA with automated axe tests and keyboard tests on every release.