Role Morph Hero
“a ____.” where the blank cycles through your roles: letters of the old role drop away with a blur, the next role springs up in a stagger, the highlighter springs to the new width and a colour wash shifts.
Try it: Watch the role morph; hover to hold, use the dots to jump or the button to pause.
Brings its own background. Paints its own soft paper/ink backdrop with a role-coloured wash via light and dark: variants, so it matches the host page. Override the surface with className (e.g. bg-*, rounded-*, min-h-*).
Installation
Install with the shadcn CLI:
npx shadcn@latest add https://www.framekitui.live/r/role-morph-hero.jsonOr, with the @framekit namespace registered: npx shadcn@latest add @framekit/role-morph-hero. You can also copy the source into components/ui/role-morph-hero.tsx (view on GitHub).
Usage
import { RoleMorphHero } from '@/components/ui/role-morph-hero'Props
| Prop | Type | Default | Notes |
|---|---|---|---|
greeting | string | 'Hi, I’m Sam Okoye —' | Line above the headline. |
roles | (string | { label: string; color?: string })[] | ['designer', 'storyteller', …] | Roles to cycle. |
description | string | — | Supporting paragraph. |
ctaLabel | string | — | Primary button label. |
onCta | () => void | — | Primary button handler. |
interval | number | 2600 | ms each role rests. |
className | string | — | Extra classes merged onto the root. |
Dependencies
motionlucide-react
Related Hero components
- Photo Strip Hero
A big headline over two tilted rails of photo cards drifting in opposite directions — they slow under the pointer, surge with scroll velocity and lift on hover.
- Depth Parallax Hero
A layered SVG landscape — sun/moon, three mountain planes and a tree line — shifting at depth-correct factors with the pointer or a slow idle sway; the giant name sits between the planes.
- Terminal Dev Hero
A developer intro with a live terminal: commands type with human rhythm, outputs stream in, a build bar fills and the window floats in 3D with the pointer. Pause and replay included.
- Spotlight Reveal Hero
A quiet paper-and-ink hero with a cursor-lit lens that reveals a saturated, grid-drawn “lit” version of the same message; the beam wanders on its own when idle and locks onto the button on keyboard…
- Route Chooser Hero
A fork in the road under a sky that follows your attention: hover or focus the left card and the sun climbs, the right one and the moon rises while a lantern walks that branch. Real buttons or links…
- Kinetic Name Hero
Your name set huge, every letter on its own spring — letters are pushed away, tilt and swell as the cursor passes, then ease home; a soft light trails the pointer and a badge circles the role.