I tested setting the cursor to cursor: pointer
which works fine, but I would like to use a custom image as a cursor. The image is stored in my src folder and I tried it in the public folder as well. I’m assuming I’m messing something up with the sytnax on "url(JavaScript-logo.png)"
import logo from "../assets/logo1.png";
...
<Typography
sx={{
"&:hover": { cursor: `url(${logo}), auto` },
}}
>
["JavaScript",
</Typography>
I have also tried it without the &:hover
, and without auto
3
Answers
I figured it out, the issue was that the image dimensions I was using were too large so I reduced the dimensions and everything works perfectly.
Have you imported the image yet?
See this guide Adding Image
There is a problem with your image. You need to take a look at that. Below is the sample code(similar to yours) which I used and it worked. I have used proper-sized
svg
. You can replace it withpng
too.SAMPLE DEMO