Over your project grid, the cursor turns into a round label of your choice, like View case. It stays out of the way on touch screens.
How to use
Make two files in your project's components folder: cursor-label.tsx and cursor-label.module.css.
Paste the code into each one, keeping the licence note at the top of the component.
It needs nothing beyond React. Your project needs CSS Modules, which Next.js and Vite already have.
Import it where you want it, then change the words, colours and sizes to yours.
The code
"use client";
import React, { useEffect, useRef, useState, useSyncExternalStore } from "react";
import styles from "./cursor-label.module.css";
/** Stiffness, damping and mass, as in most motion tools. */
export type SpringOptions = { stiffness?: number; damping?: number; mass?: number };
/** Moves a few numbers towards their targets like a spring, one frame at a time. Without options it jumps straight there. */
function createSpring(size: number, options: SpringOptions | null, write: (values: number[]) => void) {
const value = new Array<number>(size).fill(0);
const target = new Array<number>(size).fill(0);
This comes with paid plans
The code for every component comes with paid plans, along with the rest of the AI toolkit. The first component under each heading is free.
"use client";
import React, { useEffect, useRef, useState, useSyncExternalStore } from "react";
import styles from "./cursor-label.module.css";
/** Stiffness, damping and mass, as in most motion tools. */
export type SpringOptions = { stiffness?: number; damping?: number; mass?: number };
/** Moves a few numbers towards their targets like a spring, one frame at a time. Without options it jumps straight there. */
function createSpring(size: number, options: SpringOptions | null, write: (values: number[]) => void) {
const value = new Array<number>(size).fill(0);
const target = new Array<number>(size).fill(0);
This comes with paid plans
The code for every component comes with paid plans, along with the rest of the AI toolkit. The first component under each heading is free.