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

Position & Animation

0.2s
0.15s
12°
15px

Image Settings

200px
200px

Target Settings

4px

Props

contentstring

Text content with placeholders for targets (use {0}, {1}, etc.)

Default:""
targetsHoverTarget[]

Array of target configurations with text, imageUrl, linkUrl, and altText

Default:[]
onTargetClick(target: HoverTarget, index: number) => void

Callback when a target is clicked. If not provided and linkUrl exists, opens link in new tab

Default:undefined
imagePosition"above" | "below" | "left" | "right"

Position of the image relative to the target text

Default:"above"
enterSpeednumber

Enter animation duration in seconds

Default:0.2
exitSpeednumber

Exit animation duration in seconds

Default:0.15
maxRotationnumber

Maximum rotation angle for the image (in degrees)

Default:12
maxOffsetnumber

Maximum offset for image movement (in pixels)

Default:15
imageWidthnumber

Image width in pixels

Default:200
imageHeightnumber

Image height in pixels

Default:200
classNamestring

Additional CSS classes for the container

Default:""
targetClassNamestring

Additional CSS classes for target text

Default:""
targetPaddingnumber

Padding around target text to expand hover area (in pixels)

Default:4
imageBorderRadiusstring

Image border radius (CSS value)

Default:"0.75rem"
showImageShadowboolean

Show shadow on image preview

Default:true