Magnetic Text
Customize
Props
| Property | Type | Default | Description |
|---|---|---|---|
text | string | "ATTRACT" | Main display text. |
subtitle | string | "PULL · PUSH · REPEL" | Sub text rendered below the main text. |
fontSize | string | undefined (responsive) | Font size for the main text (supports clamp). Defaults to responsive value based on container width. |
subtitleSize | string | undefined (responsive) | Font size for the subtitle. Defaults to responsive value based on container width. |
letterSpacing | string | "0.05em" | Letter-spacing for the main text. |
textColor | string | "#ffffff" | Base color of the main text. |
subtitleColor | string | "#ffffff" | Color of the subtitle text. |
hoverColors | string[] | ["#ff6b6b","#f7c948","#4ecdc4","#a78bfa"] | Color array interpolated across characters on hover. |
magnetRadius | number | undefined (responsive) | Radius in px within which characters are attracted. Defaults to responsive value based on container width. |
magnetStrength | number | 0.55 | How far characters move toward the cursor (0–1). |
attractDuration | number | 0.25 | Duration (s) of the attract tween. |
returnDuration | number | 0.6 | Duration (s) of the return tween. |
entranceAnim | string | "fadeUp" | "fadeUp" | "scaleIn" | "slideLeft" | "blur" | "none". |
entranceStagger | number | 0.04 | Stagger delay (s) between each character entrance. |
entranceDuration | number | 0.7 | Duration (s) of the entrance animation per character. |
entranceDelay | number | 0.1 | Initial delay (s) before entrance animation starts. |
showCursor | boolean | true | Show a custom cursor dot and ring. |
showSubtitle | boolean | true | Show the subtitle line. |
align | string | "center" | Text alignment: "left" | "center" | "right". |
gap | string | "0px" | Gap (marginRight) between individual characters. |
textClassName | string | "" | Extra Tailwind/CSS classes applied to each main text character span. |
subtitleClassName | string | "" | Extra Tailwind/CSS classes applied to each subtitle character span. |
className | string | "" | Extra classes applied to the root container div. |
textstringMain display text.
"ATTRACT"subtitlestringSub text rendered below the main text.
"PULL · PUSH · REPEL"fontSizestringFont size for the main text (supports clamp). Defaults to responsive value based on container width.
undefined (responsive)subtitleSizestringFont size for the subtitle. Defaults to responsive value based on container width.
undefined (responsive)letterSpacingstringLetter-spacing for the main text.
"0.05em"textColorstringBase color of the main text.
"#ffffff"subtitleColorstringColor of the subtitle text.
"#ffffff"hoverColorsstring[]Color array interpolated across characters on hover.
["#ff6b6b","#f7c948","#4ecdc4","#a78bfa"]magnetRadiusnumberRadius in px within which characters are attracted. Defaults to responsive value based on container width.
undefined (responsive)magnetStrengthnumberHow far characters move toward the cursor (0–1).
0.55attractDurationnumberDuration (s) of the attract tween.
0.25returnDurationnumberDuration (s) of the return tween.
0.6entranceAnimstring"fadeUp" | "scaleIn" | "slideLeft" | "blur" | "none".
"fadeUp"entranceStaggernumberStagger delay (s) between each character entrance.
0.04entranceDurationnumberDuration (s) of the entrance animation per character.
0.7entranceDelaynumberInitial delay (s) before entrance animation starts.
0.1showCursorbooleanShow a custom cursor dot and ring.
trueshowSubtitlebooleanShow the subtitle line.
truealignstringText alignment: "left" | "center" | "right".
"center"gapstringGap (marginRight) between individual characters.
"0px"textClassNamestringExtra Tailwind/CSS classes applied to each main text character span.
""subtitleClassNamestringExtra Tailwind/CSS classes applied to each subtitle character span.
""classNamestringExtra classes applied to the root container div.
""Dependencies
Crafted withbyMohammad Tasin
