Stagger Hover Text
A component for displaying a stagger hover text.
Default
Default stagger hover text
Default - hover the text itselfHover me and watch the wave
Slower stagger - delayStepMs={60}A slower, more dramatic sweep
Stroke mode - outline text fills on hoverOutlined until you hover
Group hover - hovering anywhere in the card triggers it
Triggered by the parent cardhover the card
Continued stagger - startIndex chains two segmentsOne wave across two segments
examples.tsx
1import type { ReactNode } from "react";2import { StaggeredHoverText } from "@/registry/ui/stagger-hover-text";34const DEMOS: Array<{5 label: string;6 demo: ReactNode;7}> = [8 {9 label: "Default - hover the text itself",10 demo: (11 <StaggeredHoverText12 text="Hover me and watch the wave"13 selfHover14 className="cursor-default"15 />16 ),17 },18 {19 label: "Slower stagger - delayStepMs={60}",20 demo: (21 <StaggeredHoverText22 text="A slower, more dramatic sweep"23 delayStepMs={60}24 selfHover25 className="cursor-default"26 />27 ),28 },29 {30 label: "Stroke mode - outline text fills on hover",31 demo: (32 <StaggeredHoverText33 text="Outlined until you hover"34 charClassName="stagger-char-stroke"35 selfHover36 className="cursor-default"37 />38 ),39 },40 {41 label: "Group hover - hovering anywhere in the card triggers it",42 demo: (43 <div className="group flex cursor-pointer items-center justify-between gap-4 rounded-lg border border-border/60 bg-muted/30 px-5 py-4 transition-colors hover:border-border">44 <StaggeredHoverText text="Triggered by the parent card" />45 <span className="text-xs text-muted-foreground">hover the card</span>46 </div>47 ),48 },49 {50 label: "Continued stagger - startIndex chains two segments",51 demo: (52 <span className="stagger-group cursor-default">53 <StaggeredHoverText text="One wave " />54 <StaggeredHoverText55 text="across two segments"56 startIndex={"One wave ".length}57 charClassName="italic"58 />59 </span>60 ),61 },62];6364export function StaggerHoverTextExamples() {65 return (66 <div className="flex flex-col gap-8 p-6 text-2xl font-semibold tracking-tight">67 {DEMOS.map(({ label, demo }) => (68 <div key={label} className="flex flex-col gap-2">69 <span className="text-xs font-normal tracking-normal text-muted-foreground">70 {label}71 </span>72 {demo}73 </div>74 ))}75 </div>76 );77}
Installation & source
Install via the shadcn CLI or copy the registry files manually.
Installing via CLI merges required CSS into your global stylesheet.
bash
npx shadcn@latest add @tt-ui/stagger-hover-text
Props
| Name | Type | Default | Description |
|---|---|---|---|
| text | string | Hello, world! | The text to display |
| className | string | undefined | The class name to apply to the component |
| charClassName | string | undefined | The class name to apply to the characters |
| wrapperClassName | string | undefined | The class name to apply to the wrapper |
| delayStepMs | number | 25 | The delay between characters in milliseconds |
| startIndex | number | 0 | The index to start the stagger from |
| selfHover | boolean | false | Whether to wrap the text in its own hover group |