Hover Transition
A flexible hover wrapper with eight polished transitions, per-card direction and color controls, custom default and hover content, adjustable timing, and a built-in fallback card.
Installation#
pnpm dlx shadcn@latest add @davinciui/hover-transitionUsage#
API Reference#
| Prop | Type | Default |
|---|---|---|
defaultComponentContent shown before the pointer or keyboard focus enters. | React.ReactNode | fallback card |
hoverComponentContent revealed by the selected hover effect. | React.ReactNode | fallback hover card |
effectThe transition style used to swap the two components. | "wipe" | "ripple" | "parallax" | "curtain" | "diagonal" | "morph" | "strips" | "slide" | "wipe" |
directionThe origin or travel direction used by the active effect. | "top" | "right" | "bottom" | "left" | "top-left" | "top-right" | "bottom-right" | "bottom-left" | "center" | "right" |
durationAnimation duration in seconds. | number | 1.15 |
easingAny valid CSS easing value. | string | "cubic-bezier(0.16, 1, 0.3, 1)" |
labelAccessible label for the focusable transition wrapper. | string | "Interactive hover transition" |
interactiveWhen false, hover, focus, tilt, and glare are disabled and only the controlled active prop drives the animation. Use for ambient auto-playing previews. | boolean | true |
classNameSizing, radius, and layout classes for the outer wrapper. | string | — |
Accessibility#
The wrapper is a focusable role=group with an aria-label prop, and focus reveals the hover content with a focus-visible ring. Animated layers are aria-hidden, so assistive technology reads only the default content; there is no Escape or Enter handling.
Motion#
Eight effects transition clip-path, transform, opacity and filter using CSS timing from duration and easing. usePrefersReducedMotion sets the duration to zero and disables tilt, glare and pointer tracking; the controlled active prop can drive changes without hover.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

