UIPin
ComponentsIconsIllustrationsMotionTemplatesApps
Boards
UIPin

Free, open-source UI components, icons, illustrations, motion, templates and apps, in one search. Every item links to its source and licence.

UIPin is free. If it saved you time, you can keep it running:

Buy me a coffee
ComponentsIconsIllustrationsMotionTemplatesAppsLibrariesCompareNew this weekMCP for agentsBoardsPrivacy

Components, icons and artwork belong to their authors and are shown under their open-source licences.

Magic UI/Kinetic Text

Text effects
1 of 25
Compiling

Theme it

Every preview, live

Brand colour

Corner radius

Font

Recolours shadcn’s tokens, Tailwind’s accent colours and colours set in the code. Red, amber and green classes stay, since they usually mean error, warning or success.

25 versions·4 librariesCompare all text animations →

  • Kinetic Text
  • Text Animate
  • Text Gif
  • Blur In Text
  • Dock Text
  • Fade Text
  • Font Weight Text
  • Gradual Spacing Text
  • Letter Pull Up Text
  • Multi Direction Slide Text
  • Scale Letter Text
  • Seperate Away Text
  • Wavy Text
  • Word Pull Up Text
  • Ai Text Loading
  • Cradle Text
  • Plucked Text
  • Swoosh Text
  • Animated Gradient Text
  • Animated Shiny Text
  • Comic Text
  • Dia Text Reveal
  • Hyper Text
  • Line Shadow Text
  • Morphing Text

Kinetic Text

A text component that animates font weight of characters on hover.

npx shadcn@latest add https://magicui.design/r/kinetic-text.json
Open in v0 Docs Repo
Library
Magic UI
License
MIT
Stack
React · Tailwind CSS
Size
44 lines
Demo
From Magic UI

Code

registry/magicui/kinetic-text.tsx

import React from "react"

import { cn } from "@/lib/utils"

type As = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span"

type KineticTextProps = React.HTMLAttributes<HTMLElement> & {
  text: string
  as?: As
}

export function KineticText({
  text,
  as: Tag = "h1",
  className = "",
  style,
  ...rest
}: KineticTextProps) {
  const mergedStyle = {
    "--hover-padding": "calc(1em / 12)",
    "--text-stroke-width": "calc(1em * 125 / 6000)",
    ...(style as React.CSSProperties | undefined),
  } as React.CSSProperties

  return (
    <Tag
      {...rest}
      className={cn("flex flex-wrap font-[300]", className)}
      style={mergedStyle}
    >
      {text.split("").map((letter, i) => (
        <span
          key={i}
          aria-hidden="true"
          className="[will-change:font-weight,-webkit-text-stroke-width,padding] [-webkit-text-stroke-color:transparent] [-webkit-text-stroke-width:var(--text-stroke-width)] [transition:font-weight_0.4s,_-webkit-text-stroke-color_0.4s,_padding_0.4s] hover:[padding-inline:var(--hover-padding)] hover:font-[900] hover:[-webkit-text-stroke-color:currentcolor] hover:[-webkit-text-stroke-width:calc(var(--text-stroke-width)*2)] has-[+span+span:hover]:font-[400] has-[+span:hover]:[padding-inline:var(--hover-padding)] has-[+span:hover]:font-[600] [:hover+&]:[padding-inline:var(--hover-padding)] [:hover+&]:font-[600] [:hover+span+&]:font-[400]"
        >
          {letter === " " ? "\u00A0" : letter}
        </span>
      ))}
      <span className="sr-only">{text}</span>
    </Tag>
  )
}

More like this

Word Rotate

Magic UI·Text effects

8-bit Enemy Health Display

8bitcn·Feedback & loaders

Fuzzy Text

React Bits·Text effectsMIT+

Drape Background

Kokonut UI·Backgrounds

8-bit Health Bar

8bitcn·Feedback & loaders

8-bit Mana Bar

8bitcn·Feedback & loaders

8-bit Progress

8bitcn·Feedback & loaders

Dock Text

Eldora UI·Text effects

8-bit Slider

8bitcn·Inputs & forms

Card Nav

React Bits·NavigationMIT+

Line Shadow Text

Magic UI·Text effects

Border Trail

Motion Primitives·Cursor & effects

8-bit XP Bar

8bitcn·Feedback & loaders

Ipad

Eldora UI·Media & 3D

Bubble Menu

React Bits·BackgroundsMIT+