BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/fancy/breathing-text

Breathing Text

fancy/breathing-text
FreeComponent

A ui component.

Install it

npx shadcn@latest add https://www.fancycomponents.dev/r/breathing-text.json

Source

fancy/text/breathing-text.tsxwww.fancycomponents.dev/r/breathing-text.json
1"use client"
2
3import { ElementType } from "react"
4import { motion, Transition, Variants } from "motion/react"
5
6import { cn } from "@/lib/utils"
7
8interface TextProps extends React.HTMLAttributes<HTMLElement> {
9 /**
10 * The content to be displayed and animated
11 */
12 children: React.ReactNode
13
14 /**
15 * HTML Tag to render the component as
16 */
17 as?: ElementType
18
19 /**
20 * Initial font variation settings
21 */
22 fromFontVariationSettings: string
23
24 /**
25 * Target font variation settings to animate to
26 */
27 toFontVariationSettings: string
28
29 /**
30 * Animation transition configuration
31 * @default { duration: 1.5, ease: "easeInOut" }
32 */
33 transition?: Transition
34
35 /**
36 * Duration of stagger delay between elements in seconds
37 * @default 0.1
38 */
39 staggerDuration?: number
40
41 /**
42 * Direction to stagger animations from
43 * @default "first"
44 */
45 staggerFrom?: "first" | "last" | "center" | number
46
47 /**
48 * Delay between animation repeats in seconds
49 * @default 0.1
50 */
51 repeatDelay?: number
52}
53
54const BreathingText = ({
55 children,
56 as = "span",
57 fromFontVariationSettings,
58 toFontVariationSettings,
59 transition = {
60 duration: 1.5,
61 ease: "easeInOut",
62 },
63 staggerDuration = 0.1,
64 staggerFrom = "first",
65 repeatDelay = 0.1,
66 className,
67 ...props
68}: TextProps) => {
69 const letterVariants: Variants = {
70 initial: { fontVariationSettings: fromFontVariationSettings },
71 animate: (i) => ({
72 fontVariationSettings: toFontVariationSettings,
73 transition: {
74 ...transition,
75 repeat: Infinity,
76 repeatType: "mirror",
77 delay: i * staggerDuration,
78 repeatDelay: repeatDelay,
79 },
80 }),
81 }
82
83 const getCustomIndex = (index: number, total: number) => {
84 if (typeof staggerFrom === "number") {
85 return Math.abs(index - staggerFrom)
86 }
87 switch (staggerFrom) {
88 case "first":
89 return index
90 case "last":
91 return total - 1 - index
92 case "center":
93 default:
94 return Math.abs(index - Math.floor(total / 2))
95 }
96 }
97
98 const letters = String(children).split("")
99 const ElementTag = as
100
101 return (
102 <ElementTag
103 className={cn(
104 className,
105 // an after pseudo element is used to create a container large enough to hold the text with full weight. Helps avoid layout shifts
106// … truncated

What it pulls in

npm packages

  • motion

Files it writes

  • fancy/text/breathing-text

Facts

Registry
fancy
Type
registry:ui
Access
Free
Files written
1
Licence
the repository states none
First indexed
2026-08-02
Last confirmed
today

Go to the source

www.fancycomponents.dev danielpetho/fancy on GitHub Raw registry item This item as JSON

More from fancy

All 158 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Animated Gradient With Svganimated-gradient-with-svgfancyComponentsFreeno deps
Basic Number Tickerbasic-number-tickerfancyComponentsFree1 dep
Box Carouselbox-carouselfancyComponentsFree1 dep
Circling Elementscircling-elementsfancyComponentsFree1 dep
Css Boxcss-boxfancyComponentsFree1 dep
Cursor Attractor And Gravitycursor-attractor-and-gravityfancyComponentsFree5 deps
Drag Elementsdrag-elementsfancyComponentsFree1 dep
Elastic Lineelastic-linefancyComponentsFree1 dep
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex