Reveal
Content arrives as it scrolls into view: rising, wiping open like a mask, or growing. Children arriving together are staggered; ones that scroll in later start fresh. Readable without scripting. Effects.
Open playgroundBrief
Define the one moment worth animating.
Block
Lay out the static state first.
Move
Add motion that carries meaning.
Ship
Respect reduced motion, then release.
About
Reveal is a React component in the Effects category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { Reveal } from "@ashutoshswamy/smoui" and set children, effect, direction among its 10 props.
Install
npm i @ashutoshswamy/smouiUsage
import { Reveal } from "@ashutoshswamy/smoui";
<Reveal effect="clip" direction="up" stagger={0.08}>
<Card /><Card /><Card />
</Reveal>Props 10
- children
Each direct child reveals in turn.
ReactNode- effect
Rise travels in, clip wipes open like a mask (crisp, no blur), scale grows from slightly smaller.
"rise""clip""scale"default"rise"- direction
Edge rise comes from, or the way clip wipes.
"up""down""left""right""none"default"up"- stagger
Seconds between children that arrive together. Later arrivals start fresh.
numberdefault0.08- distance
Travel in px for rise.
numberdefault24- blur
Start soft and sharpen (rise and scale). Turn off for large blocks.
booleandefaulttrue- delay / maxDelay
Seconds before the first child, and the longest any child waits.
numberdefault0 / 0.6- amount
Share of a child that must be visible first.
numberdefault0.25- margin
IntersectionObserver rootMargin. The default waits until a child is a little inside the viewport.
stringdefault"0px 0px -8% 0px"- repeat
Replay on every re-entry.
booleandefaultfalse
More effects components
- AuroraSlow drifting colour behind your content. Only transforms animate; it stands still with reduced motion.
- BorderBeamA light that runs around the edge of whatever it wraps, at an even pace along straight sides and rounded corners alike. Reduced motion parks it still.
- CompareSliderBefore/after reveal. Drag the divider; the top layer follows on a spring. It sweeps once to show it moves.
- ConfettiButton that throws flat confetti on press. Pieces fly out, tumble, then fall and fade.
- DotFieldA grid of dots that swells and shrinks away from the pointer, then springs home. One canvas, asleep when nothing moves.
- GlassLensA magnifier that drifts after the cursor like a drop of water. Press to zoom further.