Skip to content

feat: add interactive custom cursor with hover/click states (#759)#768

Open
revatikadam0607 wants to merge 2 commits into
Coder-s-OG-s:mainfrom
revatikadam0607:feat/cursor
Open

feat: add interactive custom cursor with hover/click states (#759)#768
revatikadam0607 wants to merge 2 commits into
Coder-s-OG-s:mainfrom
revatikadam0607:feat/cursor

Conversation

@revatikadam0607

Copy link
Copy Markdown

Summary

Closes #759

Adds a lightweight custom cursor (a dot that follows the mouse exactly, plus a ring that trails
behind it) with hover and click feedback, active on desktop only.

Implementation notes

  • New file: src/components/custom-cursor.tsx — a client component that tracks the mouse and
    writes positions straight to style.transform via refs (not React state), so it doesn't
    trigger a re-render on every mouse-move event. The trailing ring animates via
    requestAnimationFrame.
  • New CSS in src/app/globals.css for the cursor's appearance and states (cursor-hovering,
    cursor-clicking).
  • Rendered once in src/app/layout.tsx (the root layout), so it applies across the whole site
    with a single insertion point.

Touch device handling

The component checks matchMedia('(pointer: coarse)') / ontouchstart on mount and exits early
on touch devices — no listeners are attached and the native cursor is never hidden. There's also
a @media (pointer: coarse) CSS rule as a backup.

Testing

  • Verified dot/ring follow the mouse smoothly on desktop Chrome/Firefox.
  • Verified hover state on links, buttons, and nav items; click state on mousedown/up.
  • Verified touch/responsive mode shows the normal cursor and doesn't break tap/scroll.
  • npx tsc --noEmit and npx eslint pass clean on all changed files.

I've resolved the issue. Kindly review it, and if everything looks good, please consider merging the corresponding PR.
Hi @codersogs-code could you please review this merged PR for a potential bonus label based on the metrics below? Thanks!
labels

@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

@revatikadam0607 is attempting to deploy a commit to the codersogs-3057's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Soumya-codr

Copy link
Copy Markdown
Collaborator

@revatikadam0607 ur Ci and Cd are failing please fix it

@revatikadam0607

Copy link
Copy Markdown
Author

@revatikadam0607 ur Ci and Cd are failing please fix it

Okay let me check it

@revatikadam0607

Copy link
Copy Markdown
Author

Done @Soumya-codr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Interactive Custom Cursor Animations for Enhanced User Experience

3 participants