A clean character-by-character word swap that flips the next word smoothly into place on hover, focus, or tap.
pnpm dlx shadcn@latest add @componentry/flipping-word-swapimport { FlippingWordSwap } from "@/components/ui/flipping-word-swap"
<div className="flex min-h-[400px] items-center justify-center">
<FlippingWordSwap
word1="Componentry"
word2="Consistency"
duration={400}
stagger={44}
className="text-zinc-950 dark:text-zinc-100"
toClassName="text-zinc-950 dark:text-zinc-100"
style={{
fontSize: 48,
fontWeight: 700,
lineHeight: 1,
letterSpacing: "-0.025em",
}}
/>
</div>| Property | Type | Default |
|---|---|---|
word1The word displayed at rest. | string | — |
word2The word revealed during interaction. | string | — |
durationDuration of each character flip in milliseconds. | number | 400 |
staggerDelay between neighboring character flips in milliseconds. | number | 44 |
classNameAdditional classes for layout and inherited typography. | string | — |
toClassNameAdditional classes applied only to the revealed word. | string | — |
styleInline styles applied to the container for dynamic typography and color controls. | CSSProperties | — |
toStyleInline styles applied only to the revealed word. | CSSProperties | — |
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.