$npx @dinachi/cli@latest add text-morph
Deploying
childrenDeploying
Deployed
Deploy failed
blurdistancedurationdeploy-status.tsx
import { TextMorph } from "@/components/ui/text-morph"
type Status = "Deploying" | "Deployed" | "Deploy failed"
// Changing status runs the morph.
export function DeployStatus({ status = "Deploying" }: { status?: Status }) {
return <TextMorph>{status}</TextMorph>
}Usage
import { TextMorph } from "@/components/ui/text-morph"
export function DeployStatus({ done }: { done: boolean }) {
return <TextMorph>{done ? "Deployed" : "Deploying"}</TextMorph>
}Examples
Deploying
A status label rearranging in place.
import { useState } from 'react';
import { TextMorph } from '@/components/ui/text-morph';
const statuses = ['Deploying', 'Deployed', 'Deploy failed'];
export function Example() {
const [index, setIndex] = useState(0);
return (
<TextMorph className="text-xl font-medium">{statuses[index]}</TextMorph>
);
}SubscribedRelated: most characters slide
SubscribedUnrelated: an expensive crossfade
The effect lives on how much the two strings share.
import { TextMorph } from '@/components/ui/text-morph';
export function Example() {
return (
<div className="flex flex-col gap-6 text-lg">
{/* Most characters survive and slide. */}
<TextMorph>{subscribed ? 'Subscribed' : 'Unsubscribed'}</TextMorph>
{/* Nothing to share, so every character fades: an expensive crossfade. */}
<TextMorph>{subscribed ? 'Subscribed' : 'Archive'}</TextMorph>
</div>
);
}ConnectingConnectingConnecting
How far the arriving and departing characters travel.
import { TextMorph } from '@/components/ui/text-morph';
export function Example() {
return (
<div className="flex flex-col gap-4 text-lg">
<TextMorph blur={0} distance={0}>{label}</TextMorph>
<TextMorph>{label}</TextMorph>
<TextMorph blur={6} distance={16}>{label}</TextMorph>
</div>
);
}Notes
Motion tier
Needs motion. add --all skips it; install with add --motion or by name.
When to use it
Characters shared by both strings slide to their new places; the rest fade. The more the strings share, the better it works.
- Short labels that change in place:
DeployingtoDeployed, a unit, a toggle's label. - Skip it for unrelated strings and sentences; every character animates, at a cost per character.
- For numbers, use Number Ticker.
Behaviour
- Exits run at 60% of the entrance duration.
- Departing characters leave the flow at once, so the gap closes immediately.
- Splits by grapheme: combining accents and multi-codepoint emoji stay whole. Repeated characters keep distinct identities.
- No per-character stagger.
API
childrenstring
The text to show. Changing it runs the morph. Required.blurnumber = 2
Blur radius in px on arriving and departing characters.distancenumber = 8
Vertical travel in px for arriving and departing characters.durationnumber = 0.25
Seconds. Keep it under 0.3.Accessibility
- At rest the text is one text node: selectable, findable and wrappable. It splits only during the morph.
- During the morph, split characters are
aria-hiddenand a visually hidden copy is read instead. - Reduced motion never splits the text; the change becomes a short crossfade.