本文へ移動
日本語
「モーフィング文字」は Pro に含まれます。解除するとプレビューが表示されます。

仕組み

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.

向いている場面

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

向かない場面

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

使い方

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>
  )
}

プロパティ

プロパティ型既定値説明
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.

アクセシビリティ

  • 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.

モーション

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.

プロジェクトに追加

Pro メンバーはプロンプトをコピーし、コーディングエージェントが無料コンポーネントと同じ手順でソースを導入します。

MorphingText.jsxmorphing-text.csstokens.cssREADME.md

2 つのファイルを一緒に導入します。スタイルは tokens.css の変数を読み、予備の値も持つため、単体でも表示できます。

文字の動き
「スクランブル文字」は Pro に含まれます。解除するとプレビューが表示されます。