Text MorphFreev1.0.0
A label that changes into its next state without a jump: shared letters glide to their new places, the rest blur out and in, and the width eases so the button around it resizes smoothly.
pnpm dlx shadcn@latest add https://beautiful-ui.dev/r/lumen-text-morph.jsonpnpm dlx shadcn@latest add https://beautiful-ui.dev/r/radix-nova/lumen-text-morph.jsonFree, no account or key. Use the command for your project's primitives: a radix-*, new-york or default style in components.json is Radix, a base-* style is Base UI. With the @beautiful-ui registry added, @beautiful-ui/<name> picks for you.
Install by hand
- 1. No extra packages: React and Tailwind CSS v4 are enough.
- 2. Copy the files to these paths (Source below, or save them all as a .zip)
- components/ui/lumen/controls/text-morph.tsx
- 3. Paste styles.css into your global CSS, after @import "tailwindcss";
- 4. Install what it builds on first: shadcn's cn helper (lib/utils.ts, from npx shadcn init), the theme foundation (its tokens and base styles)
Styles didn't apply?
The CLI adds the styles to the CSS file named in components.json (tailwind.css). Check that it points at your global stylesheet, that the project uses Tailwind CSS v4, and that the file is imported in your root layout. Installed by hand: paste styles.css into that file.
Usage
Import it and pass your content. The props that matter most are listed next.
"use client";
import * as React from "react";
import { Button } from "@/components/ui/lumen/button";
import { TextMorph } from "@/components/ui/lumen/controls/text-morph";
export function FollowButton() {
const [following, setFollowing] = React.useState(false);
return (
<Button variant={following ? "secondary" : "default"} aria-pressed={following} onClick={() => setFollowing((f) => !f)}>
<TextMorph>{following ? "Following" : "Follow"}</TextMorph>
</Button>
);
}Props
children–stringThe label. Change it and it morphs.
motion"full""full" | "subtle" | "off"full: glide and blur; subtle: shorter, no blur; off: swap at once. Reduced motion is always off.
Source
components/ui/lumen/controls/text-morph.tsx