Reference

API reference

The Static generator and CLI, the Animated loader and runtime, families and helpers.

Entry points

Import What it is
glint-cursors/static Static generator for Node: generateStatic, listFamilies, loadFamily
glint-cursors/static/browser Browser-safe generator: generateFromFamily (no file system)
glint-cursors/animated Loader: loadCursor, canUseCursor, FAMILY_NAMES, preference helpers
glint-cursors/animated/cursor Runtime: createCursor (normally reached through loadCursor)
glint-cursors/animated/families/<name> One family definition
glint-cursors/animated/auto Script-tag entry (reads data-* options)
glint-cursors/preference “Use default cursor” helpers
glint-cursors/agent Agent prompt builder
glint-cursors/catalog.json Every cursor, as data

generateStatic(options)

import { generateStatic } from 'glint-cursors/static';
const { css, cssName, files, colors } = generateStatic({
  family: 'bold-arrow',   // required; see listFamilies()
  variant: 'dark',        // 'light' | 'dark' | 'accent'   (default 'light')
  accent: '#2F6BFF',      // hex                           (default '#2F6BFF')
  scope: '#hero',         // CSS selector list, no *       (default 'html')
  output: 'files',        // 'files' (CSS + SVGs) | 'inline' (one CSS with data URIs)
});
// files: [{ name: 'bold-arrow-dark.css', contents }, { name: 'bold-arrow-dark-normal.svg', … }, …]

Throws on an unknown family, variant or output, an invalid colour, insufficient fill–keyline contrast, or an unsafe scope. The accent is validated even for light and dark variants.

generateFromFamily(family, options)

The same generator without the file system, for browsers and edge runtimes. family is { id, name, states: { normal: { svg, hotspot }, hover: { svg, hotspot } } }, as in catalog.json. Options are the same as above minus family. Output is identical to generateStatic.

CLI: cursor-static

cursor-static <family> --out <dir> [options]   write CSS and SVG files
cursor-static <family> --inline [options]      print one CSS file with the SVGs inlined
cursor-static --list                           list families

--variant <light|dark|accent>   --accent <hex>   --scope <selector>

loadCursor(options)

import { loadCursor } from 'glint-cursors/animated';
const cursor = await loadCursor({
  family: 'dot-ring',   // a name from FAMILY_NAMES, or a family object   (default 'morph')
  variant: 'light',     // 'light' | 'dark' | 'accent'
  accent: '#2F6BFF',
  scope: '#hero',       // selector (first match) or element             (default: whole page)
  mode: 'replace',      // 'replace' | 'enhance'
});

Resolves to null without a fine, hover-capable pointer, or under forced colours or “increase contrast”, without downloading the runtime. Throws on an unknown family name. Safe to import during SSR.

The cursor handle

Member
enable() / disable() turn on and off, keeping the instance
destroy() remove everything; call on unmount
setColors(variant, accent?) change colours at runtime
state idle, hover, label, direction, or a resting state: yield, outside, away, keyboard, touch, blocked, stepped-down, off
mode replace or enhance (replace becomes enhance inside an iframe)
level frame-monitor step: 0 normal, 1 calm, 2 handed back

Only one cursor instance is active at a time. A second createCursor call returns the existing handle; call destroy() first to replace it.

createCursor(options)

The runtime itself. Takes the same options as loadCursor, but family must be a family object (import dotRing from 'glint-cursors/animated/families/dot-ring'), except morph, which is built in. Also accepts frameMonitor: { threshold, windowMs, gapMs }.

Families

morph, dot-ring, elastic, squish, blob, spotlight, arrow-chip, brand. The brand family needs:

loadCursor({ family: 'brand', brand: { src: '/logo-cursor.svg', hotspot: [4, 4], size: 32, hoverSrc: '/logo-cursor-hover.svg' } });

size is an integer from 8 to 64 (default 32); hotspot defaults to [0, 0]. The image is rendered as an <img>, not inline SVG.

Preference helpers

applyNativePreference(on?), getNativePreference(), setNativePreference(on). See the toggle.

agentPrompt(entry, options, product)

Builds the per-cursor agent prompt. Options: variant, accent, scope, mode, via ('npm' or 'files'), output ('files' or 'inline'), brand. See Agents.