Sections
Get Started
Components
- Accordion
- Alert Dialog
- Animated Gradient Text
- Animated Shiny Text
- Avatar
- Badge
- Bento Box
- Bento Grid
- Border Beam
- Breadcrumbs
- Card
- Checkbox
- Custom Cursor
- Dialog
- Glow Border
- Glow Card
- Hyper Text
- Logo Beam
- Marquee
- Number Counter
- Popover
- Ripple Button
- Scroll Area
- Separator
- Shimmer Button
- Shinny Icons
- Tabs
- Terminal
- Text Animate
- Theme Toggler
- Typing Animation
- Word Rotate
Move your mouse aroundTap anywhere to see the cursor
import { CustomCursor } from "@/components/ui/custom-cursor"
export function CustomCursorDemo() {
return (
<>
<span className="hidden md:block">Move your mouse around</span>
<span className="block md:hidden">Tap anywhere to see the cursor</span>
<CustomCursor />
</>
)
}
Installation
pnpm dlx shadcn@latest add https://ebonui.com/r/custom-cursor.json
Usage
import { customCursor } from "@/components/ui/custom-cursor"<customCursor />Hiding Default Browser Cursor
To prevent the default browser cursor from overlapping with the custom cursor, add the following CSS globally:
* {
cursor: none !important;
}Optional: Keep text cursor for inputs
input,
textarea,
select {
cursor: text !important;
}💡 If you're using Tailwind CSS, you can add cursor-none to your layout wrapper:
<div className="cursor-none">
<customCursor />
{/* your app */}
</div>Props
| Prop | Type | Default | Description |
|---|---|---|---|
cursor | React.ReactNode | <DefaultCursorSVG /> | Custom cursor component to replace the default cursor |
springConfig | SpringConfig | See below | Configuration object for the spring animation behavior |
SpringConfig Type
interface SpringConfig {
damping: number // Controls how quickly the animation settles
stiffness: number // Controls the spring stiffness
mass: number // Controls the virtual mass of the animated object
restDelta: number // Controls the threshold at which animation is considered complete
}Default Spring Configuration
const defaultSpringConfig = {
damping: 45,
stiffness: 400,
mass: 1,
restDelta: 0.001,
}Browser Support
Compatible with all modern browsers that support:
requestAnimationFrame- CSS transforms
- Pointer events
Accessibility
When using this component, consider that:
- Users navigating via keyboard will not see the custom cursor
- You may want to provide alternative visual cues for interactive elements
- Some users may have motion sensitivity, so consider providing a way to disable the animation
Credits
- Credit to @Code_Parth for the original concept and implementation
Support Ebon UI by giving it a star on GitHub!
A lot of work goes into maintaining and improving Ebon UI. Your stars help show your support and encourage further development.
Star on Github