Hover Preview

Interactive text image previews when hovering over target words.

hover-preview-tw
Built with React, TypeScript, and brought to life with Motion.

Customize

0.2s
0.15s
4px
12°
15px
200px
200px

Props

NameTypeDefaultDescription
contentstring""Text content with placeholders for targets (use {0}, {1}, etc.)
targetsHoverTarget[][]Array of target configurations with text, imageUrl, linkUrl, and altText
onTargetClick(target: HoverTarget, index: number) => voidundefinedCallback when a target is clicked. If not provided and linkUrl exists, opens link in new tab
imagePosition"above" | "below" | "left" | "right""above"Position of the image relative to the target text
enterSpeednumber0.2Enter animation duration in seconds
exitSpeednumber0.15Exit animation duration in seconds
maxRotationnumber12Maximum rotation angle for the image (in degrees)
maxOffsetnumber15Maximum offset for image movement (in pixels)
imageWidthnumber200Image width in pixels
imageHeightnumber200Image height in pixels
classNamestring""Additional CSS classes for the container
targetClassNamestring""Additional CSS classes for target text
targetPaddingnumber4Padding around target text to expand hover area (in pixels)
imageBorderRadiusstring"0.75rem"Image border radius (CSS value)
showImageShadowbooleantrueShow shadow on image preview