Cursor

A cursor component, great for realtime interactive applications.

Installation

npx love-ui@latest add cursor

Usage

import { Cursor, CursorPointer, CursorBody, CursorName, CursorMessage } from "@/components/cursor"
<Cursor>
  <CursorPointer />
  <CursorBody>
    <CursorName>John Doe</CursorName>
    <CursorMessage>Editing...</CursorMessage>
  </CursorBody>
</Cursor>

Features

  • Customizable cursor color with automatic text color contrast adjustment
  • Optional name label display
  • Optional message display
  • Smooth cursor pointer with tooltip-style appearance
  • Fully accessible with ARIA attributes
  • Responsive and performant with optimized rendering

Examples

Cursor only

Cursor with name

Cursor with message

Cursor with name and message

Cursor with custom color

Props

Cursor

Extends HTMLAttributes<HTMLSpanElement>

CursorPointer

Extends SVGProps<SVGSVGElement>

PropTypeDefaultDescription
classNamestring-Additional CSS classes for the pointer

CursorBody

Extends HTMLAttributes<HTMLSpanElement>

PropTypeDefaultDescription
childrenReactNode-Content to display in the cursor body (name, message, etc)
classNamestring-Additional CSS classes

CursorName

Extends HTMLAttributes<HTMLSpanElement>

CursorMessage

Extends HTMLAttributes<HTMLSpanElement>