BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/fancy/variable-font-and-cursor

Variable Font And Cursor

fancy/variable-font-and-cursor
FreeComponent

A ui component.

Install it

npx shadcn@latest add https://www.fancycomponents.dev/r/variable-font-and-cursor.json

Source

fancy/text/variable-font-and-cursor.tsxwww.fancycomponents.dev/r/variable-font-and-cursor.json
1"use client"
2
3import React, { ElementType, useCallback, useRef } from "react"
4import { motion, useAnimationFrame } from "motion/react"
5
6import { cn } from "@/lib/utils"
7import { useMousePositionRef } from "@/hooks/use-mouse-position-ref"
8
9/**
10 * Interface for defining a single font variation axis.
11 * Each axis represents a dimension of variation in a variable font. You should check the font variation settings of the font you are using to see the available axes.
12 */
13interface FontVariationAxis {
14 /**
15 * The name of the font variation axis (e.g., "wght" for weight, "slnt" for slant).
16 * This corresponds to the OpenType variation axis tags, but can be arbitrary. Make sure to check the font variation settings of the font you are using to see the available axes.
17 */
18 name: string
19
20 /**
21 * The minimum value for this axis.
22 * Applied when the cursor is at the left edge (for x-axis) or top edge (for y-axis).
23 */
24 min: number
25
26 /**
27 * The maximum value for this axis.
28 * Applied when the cursor is at the right edge (for x-axis) or bottom edge (for y-axis).
29 */
30 max: number
31}
32
33/**
34 * Interface for mapping cursor position to font variation settings.
35 * Allows independent control of two font variation axes based on cursor movement.
36 */
37interface FontVariationMapping {
38 /**
39 * Font variation axis controlled by horizontal cursor movement.
40 */
41 x: FontVariationAxis
42
43 /**
44 * Font variation axis controlled by vertical cursor movement.
45 */
46 y: FontVariationAxis
47}
48
49/**
50 * Props for the VariableFontAndCursor component.
51 */
52interface TextProps extends React.HTMLAttributes<HTMLElement> {
53 /**
54 * The text content to display and animate.
55 * Required prop with no default value.
56 */
57 children: React.ReactNode
58
59 /**
60 * HTML Tag to render the component as.
61 * @default "span"
62 */
63 as?: ElementType
64
65 /**
66 * Mapping configuration that defines how cursor position affects font variation settings.
67 * Maps x and y cursor positions to specific font variation axes and value ranges.
68 * Required prop with no default value.
69 */
70 fontVariationMapping: FontVariationMapping
71
72 /**
73 * Reference to the container element for mouse tracking.
74 * The cursor position will be calculated relative to this container's bounds.
75 * Required prop with no default value.
76 */
77 containerRef: React.RefObject<HTMLDivElement | null>
78}
79
80const VariableFontAndCursor = ({
81 children,
82 as = "span",
83 fontVariationMapping,
84 className,
85 containerRef,
86// … truncated

What it pulls in

npm packages

  • motion

Other registry items

  • hooks/use-mouse-position-ref

Files it writes

  • fancy/text/variable-font-and-cursor

Facts

Registry
fancy
Type
registry:ui
Access
Free
Files written
1
Licence
the repository states none
First indexed
2026-08-01
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
Breathing Textbreathing-textfancyComponentsFree1 dep
Circling Elementscircling-elementsfancyComponentsFree1 dep
Css Boxcss-boxfancyComponentsFree1 dep
Cursor Attractor And Gravitycursor-attractor-and-gravityfancyComponentsFree5 deps
Drag Elementsdrag-elementsfancyComponentsFree1 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