Ir al contenido
Español
Texto que se transforma viene con Pro. La vista previa aparece al desbloquearlo.

Cómo funciona

All words are stacked invisibly in one grid cell, so the box takes the width of the longest and nothing around it moves. On each change the outgoing word blurs and fades while the incoming one sharpens out of the same place, both on one ease-in-out. In liquid mode an SVG alpha threshold is applied to the two words only while they overlap, so their blurred shapes fuse and pull apart like ink in water; before and after, the filter is off and the text is perfectly crisp. The blur mode adds a slight vertical drift instead. The cycle is a pausable timer, so it stops with the page.

Úsalo para

  • One changing word at the end of a hero headline.
  • Short taglines that list qualities, audiences or use cases.

Busca otra opción cuando

  • Information people must read, such as status or prices.
  • Long words in narrow layouts: the box reserves the longest word's width.

Uso

import { MorphingText } from './MorphingText.jsx'

export function Hero() {
  return (
    <h1>
      Interfaces that feel{' '}
      <MorphingText words={['calm', 'precise', 'alive', 'yours']} srText="calm, precise, alive and yours" mode="gooey" />
    </h1>
  )
}

Propiedades

PropiedadTipoPor defectoQué hace
wordsstring[]—Words to cycle through.
mode'gooey' | 'blur''gooey'Liquid fusion with an SVG alpha threshold, or a soft blur crossfade.
intervalnumber2600Time each word stays, in ms (at least the morph + 400).
morphDurationnumber900Length of each morph in ms.
pausedbooleanfalseStops the cycle and resumes with the time left.
srTextstring—What screen readers read once instead of the cycling word. Defaults to the words joined by commas.
align'start' | 'center''start'Alignment of shorter words inside the reserved width.
asElementType'span'Element to render.

Accesibilidad

  • Screen readers read srText once (by default all words, comma separated); the cycling stage is aria-hidden, so nothing is announced repeatedly.
  • The cycle pauses through the paused prop; give users a pause control when it runs for longer than five seconds alongside other content.
  • Between morphs no filter is applied, so the resting word is crisp at full contrast.
  • Reduced motion replaces the blur and threshold with a 300ms fade.

Movimiento

Each morph takes 900ms (adjustable) on an ease-in-out; words rest for the remainder of the 2.6s interval. Liquid mode blurs to 10px under the threshold; blur mode to 6px with a 0.12em drift.

Añádelo a tu proyecto

Los miembros Pro copian un prompt y su agente de programación instala el código, igual que con los gratuitos.

MorphingText.jsxmorphing-text.csstokens.cssREADME.md

Los dos archivos se instalan juntos. La hoja de estilos lee las variables de tokens.css y lleva valores de reserva, así que también funciona sola.

Texto animado
Texto que se descifra viene con Pro. La vista previa aparece al desbloquearlo.