Fancy Components
repository·main·Indexed 25 days ago
https://github.com/danielpetho/fancyA free and open source library of animated React components and microinteractions designed to add visual flair to web applications. Built with React 18, TypeScript, Tailwind CSS, and the motion package, it includes components such as Animated Gradient With SVG, PixelTrail, CirclingElements, and 3D CSS Box.
What's inside fancy
- Fancy Components is a library of animated React components and microinteractions designed to add visual flair to web applications. It is free and open source.
Use the UnderlineToBackground component
mainTheUnderlineToBackgroundcomponent animates a text underline into a text background. It works by creating an absolutedivpositioned below the text that expands its height from a thin line to cover the full text height. It also transitions the text color to ensure contrast against the new background color.Understand Underline Animation implementation
mainThe Underline Animation components do not use the standard CSS
text-decoration-line: underlineproperty. Instead, they render an absolute-positioneddivelement below the text. The dimensions of this underline are calculated relative to the font size using the following ratios:underlineHeightRatio: Controls the height of the underline (defaults to0.1or 10% of font size).underlinePaddingRatio: Controls the padding below the text (defaults to0.01or 1% of font size).
Animation Variants
- Center: The underline grows outward from the center point.
- Comes In Goes Out: The underline enters from one side, then exits from the other side.
- Goes Out Comes In: The underline exits from one side, then re-enters from the opposite side.
Get started with Fancy Components
mainFancy Components is a collection of playful, ready-to-use React components and microinteractions designed to add personality to web interfaces. The library is built using React, TypeScript, Tailwind CSS, and Motion (formerly Framer Motion).
To begin using these components in your project, follow the Installation guide.
Install Scramble Hover component
mainYou can install the
Scramble Hovercomponent using the shadcn CLI:shadcn add @fancy/scramble-hoverUse Variable Font Hover By Letter component
mainThe
variable-font-hover-by-lettercomponent animates font variation settings of individual letters. It requires a variable font to function.You must provide
fromFontVariationSettingsandtoFontVariationSettingsprops using the CSS font-variation-settings syntax. These strings define the starting and target states of the font axes (e.g., weight, slant, width).Note: Always verify the available axes and their specific ranges in your font's documentation before configuring the props.
Demo requirements for components
mainEach component requires at least one demo showcasing it in action. Demos should be visually engaging and responsive across all viewport sizes. Whiletailwind.config.tsprovides consistent color classes, creative freedom is encouraged to create high-impact, 'edgy' graphic-designer style visuals.Install Random Letter Swap (Ping Pong Animation)
mainTo install the version of the Random Letter Swap component that plays the animation timeline in a ping pong fashion, use the following CLI command:Add a component manually
mainTo add a component without the CLI, navigate to the component's documentation page, locate the "Installation" section, and copy the source code(s). You will need to manually update the import paths in the copied code to match your project structure.Install the Basic Number Ticker component
mainYou can install the
BasicNumberTickercomponent using the shadcn CLI:shadcn add @fancy/basic-number-tickerUse the Scroll and Swap Text component
mainThe
Scroll and Swap Textcomponent creates a text effect where letters swap vertically based on scroll progress.Important Implementation Notes:
- The
containerRefprop must point to a container element that has a non-static position (e.g.,relative,fixed, orabsolute) to ensure scroll offset is calculated correctly. - You may need to adjust the
offsetand the container's position to achieve the desired animation timing. The component uses Framer Motion'suseScrollhook internally.
- The
Install the Gooey SVG Filter component
mainYou can install the
@fancy/gooey-svg-filtercomponent using the shadcn CLI.shadcn add @fancy/gooey-svg-filter