SlideIn

A small, fixed-distance jump-and-fade entrance triggered by IntersectionObserver, from the left, right, or bottom edge.

Installation

npx dafink-ui add slide-in

Demo

Jumps in from the bottom
Jumps in from the left
Jumps in from the right

Props

NameTypeDefaultDescription
direction'left' | 'right' | 'bottom''bottom'Which edge the element jumps in from when scrolled into view.
distancenumber24Pixel distance of the jump.
oncebooleantrueReveal only on first entry. When false, content re-hides on exit and re-reveals on re-entry.
childrenReactNode-Content to reveal.
classNamestring''Additional CSS classes.

Accessibility

SlideIn explicitly checks window.matchMedia('(prefers-reduced-motion: reduce)') in a useEffect before ever hiding content, skipping the IntersectionObserver and leaving children rendered fully visible when the user prefers reduced motion. The wrapper is a plain, non-decorative <div> — its children are real content, not aria-hidden — and it adds no role, tabindex, or focus handling, so it never changes the keyboard behavior of whatever it wraps.