TextReveal Text
Reveal Text
Reveals text with a fade or slide-in effect, optionally triggered on scroll into view.
Reveal text with fade/slide!
Slide in from left
Delayed reveal
This reveals when in viewCode
1
Install with shadcn Beta
Terminal
npx shadcn@latest add "https://smoothui.dev/r/reveal-text.json"
Or install the demo
Terminal
npx shadcn@latest add "https://smoothui.dev/r/reveal-text-demo.json"
How to use
Demo.tsx
"use client"
import RevealText from "@/components/smoothui/ui/RevealText"
export default function RevealTextDemo() {
return (
<div className="relative max-w-md space-y-6">
<div>
<RevealText>Reveal text with fade/slide!</RevealText>
<div>
<RevealText direction="left" className="text-brand text-lg font-bold">
Slide in from left
</RevealText>
</div>
<div>
<RevealText delay={500} className="text-2xl font-semibold">
Delayed reveal
</RevealText>
</div>
<div style={{ height: 100 }} />
<RevealText triggerOnView className="text-xl font-bold">
This reveals when in view
</RevealText>
</div>
</div>
)
}
Props
Prop | Type | Description |
---|---|---|
children | string | The text to reveal. |
direction? | "up" | "down" | "left" | "right" | Direction of reveal (default: 'up'). |
delay? | number | Delay before reveal in ms. |
triggerOnView? | boolean | Animate when scrolled into view (default: false). |
className? | string | Optional additional class names. |