Components
Reveal
NativeContent that arrives as it scrolls into view: from blur to sharp, sliding up or fading.
From blur to sharp. Scroll this block out of view and back to see it again.
Sliding up. Scroll this block out of view and back to see it again.
Fading in. Scroll this block out of view and back to see it again.
Installation
npx nook-ui@latest add revealPrompt
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 "Reveal" component to this project, exactly as Nook ships it.
Content that arrives as it scrolls into view: from blur to sharp, sliding up or fading.
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 reveal`. It writes `components/ui/reveal.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/reveal.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 { Reveal } from "@/components/ui/reveal";
export default function RevealDefault() {
return (
<div className="grid w-full max-w-md gap-4">
{["From blur to sharp", "Sliding up", "Fading in"].map((text, i) => (
<Reveal key={text} effect={(["blur", "slide", "fade"] as const)[i]} delay={i * 120} repeat>
<p className="rounded-lg border-(length:--edge) border-(--field-edge) bg-card p-4">{text}. Scroll this block out of view and back to see it again.</p>
</Reveal>
))}
</div>
);
}
```
API
- `Reveal`: Wraps one block.
- `effect` (`fade | blur | slide`): How it arrives.
- `delay` (`number`): Milliseconds to wait, to stagger a row.
- `repeat` (`boolean`): Play every time it scrolls into view.
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: Content is in the document from the start, so it is read by assistive tech even before it appears. With reduced motion, or without scripting, it is simply there.
Done when the component renders like the example in light and dark mode and the project type-checks.Usage
import { Reveal } from "@/components/ui/reveal";
export default function RevealDefault() {
return (
<div className="grid w-full max-w-md gap-4">
{["From blur to sharp", "Sliding up", "Fading in"].map((text, i) => (
<Reveal key={text} effect={(["blur", "slide", "fade"] as const)[i]} delay={i * 120} repeat>
<p className="rounded-lg border-(length:--edge) border-(--field-edge) bg-card p-4">{text}. Scroll this block out of view and back to see it again.</p>
</Reveal>
))}
</div>
);
}Examples
Three effects
fade
Appears when it scrolls into view.
blur
Appears when it scrolls into view.
slide
Appears when it scrolls into view.
Repeats
Every time you scroll back
This card plays again each time it enters the screen.
Props
Reveal
Wraps one block.
| Prop | Type | Default | Description |
|---|---|---|---|
| effect | fade | blur | slide | – | How it arrives. |
| delay | number | – | Milliseconds to wait, to stagger a row. |
| repeat | boolean | – | Play every time it scrolls into view. |
Accessibility
Content is in the document from the start, so it is read by assistive tech even before it appears. With reduced motion, or without scripting, it is simply there.
Checked against WCAG 2.1 AA with automated axe tests and keyboard tests on every release.