Hover & Pointer
The 11 effects H01–H11: purpose, API, options, examples, reduced motion and cost.
Experimental and not on npm
Hover effects react to a mouse or pen inside the box and to keyboard :focus-visible, except magnetic pull, pointer parallax and the cursor follower, which are decorative and follow the pointer only. Touch is opt-in through pointerTypes. <Hover> accepts one preset or a list. Effects marked with hover.css draw on a package-owned ::before or ::after layer; an element with its own ::before cannot use them. Never put information in a hover effect only.
H01 · Lift
lift raises the element: distance (4 px), optional scale and a shadow drawn on the package layer. Under reduced motion only the shadow remains.
- Import
@neshel-ui/animations/hover- API
lift, Hover- Stylesheet
@neshel-ui/animations/hover.css- Reduced motion
static— the decoration or content stays still- Performance
- Transform and opacity, one write per frame through the shared scheduler; no layout work per frame.
"use client";
import "@neshel-ui/animations/hover.css";
import { Hover, lift } from "@neshel-ui/animations/hover";
export default function H01Example() {
return (
<Hover preset={lift} options={{ distance: 8, scale: 1.02 }} asChild>
<a
href="#h01"
className="rounded-xl border border-neshel-border bg-neshel-surface p-6 text-neshel-surface-foreground inline-block"
>
Hover or focus me
</a>
</Hover>
);
}Options: LiftOptions
LiftOptions
H01 — Lift: translate up (transform layer) plus a shadow on the decor layer.
| Prop | Type | Default | Description |
|---|---|---|---|
| disabled | boolean | — | Turn the effect off and return to rest. |
| distance | number | — | Lift distance in px (0–40, default 4). |
| pointerTypes | readonly HoverPointerType[] | — | Pointer types that activate the effect (default mouse and pen; touch is opt-in). |
| reducedMotion | ReducedMotion | "user" | Reduced-motion policy (default "user"). |
| scale | number | — | Scale while lifted (1–1.2, default 1). |
| shadow | boolean | — | Render the lift shadow on the decor layer (default true; needs hover.css). |
| spring | SpringOptions | SpringPreset | "snappy" | Spring of the transition (default "snappy"). |
H02 · Glow
glow draws a ring with a soft halo: color, size (3 px) and blur (16 px). It complements, and does not replace, the visible focus ring of your control.
- Import
@neshel-ui/animations/hover- API
glow, Hover- Stylesheet
@neshel-ui/animations/hover.css- Reduced motion
static— the decoration or content stays still- Performance
- Repaints the element (colour, gradient, clip, mask, blur or stroke) while it runs; keep the area small.
"use client";
import "@neshel-ui/animations/hover.css";
import { glow, Hover } from "@neshel-ui/animations/hover";
export default function H02Example() {
return (
<Hover preset={glow} options={{ size: 4, blur: 24 }} asChild>
<a
href="#h02"
className="rounded-xl border border-neshel-border bg-neshel-surface p-6 text-neshel-surface-foreground inline-block"
>
Hover or focus me
</a>
</Hover>
);
}Options: GlowOptions
GlowOptions
H02 — Glow / ring: a soft ring and glow on the decor layer (additive; never replaces focus styles).
| Prop | Type | Default | Description |
|---|---|---|---|
| blur | number | — | Glow blur in px (0–64, default 16). |
| color | string | — | Glow colour (CSS colour; default the theme ring colour or indigo). |
| disabled | boolean | — | Turn the effect off and return to rest. |
| pointerTypes | readonly HoverPointerType[] | — | Pointer types that activate the effect (default mouse and pen; touch is opt-in). |
| reducedMotion | ReducedMotion | "user" | Reduced-motion policy (default "user"). |
| size | number | — | Ring spread in px (0–16, default 3). |
| spring | SpringOptions | SpringPreset | "snappy" | Spring of the transition (default "snappy"). |
H03 · Tilt 3D
<Tilt3D> turns the element towards the pointer: by default the corner under the pointer goes inwards; reverse lifts it. Options: maxTilt, perspective, scale, axis, spring and focusTilt for keyboard focus. useTilt3D and createTilt3D offer the same without the component.
- Import
@neshel-ui/animations/hover- API
Tilt3D, useTilt3D, createTilt3D, tilt3D- Stylesheet
@neshel-ui/animations/hover.css- Reduced motion
off— no motion at all- Performance
- Transform and opacity, one write per frame through the shared scheduler; no layout work per frame.
"use client";
import "@neshel-ui/animations/hover.css";
import { Tilt3D } from "@neshel-ui/animations/hover";
export default function H03Example() {
return (
<Tilt3D maxTilt={12} scale={1.03} asChild>
<a
href="#h03"
className="rounded-xl border border-neshel-border bg-neshel-surface p-6 text-neshel-surface-foreground inline-block w-64"
>
The pressed corner goes inwards; reverse inverts it.
</a>
</Tilt3D>
);
}Options: Tilt3DOptions
Tilt3DOptions
| Prop | Type | Default | Description |
|---|---|---|---|
| axis | Tilt3DAxis | "both" | Which rotation axes follow the pointer (default "both"). |
| disabled | boolean | — | Turn the effect off and return to rest. |
| focusTilt | boolean | true | Keyboard focus inside the element shows a gentle fixed pose (default true). |
| maxTilt | number | — | Largest rotation in degrees at the element's edges (default 10, range 0–45). |
| perspective | number | — | Perspective distance in px; smaller is more dramatic (default 1000, at least 100). |
| pointerTypes | readonly Tilt3DPointerType[] | — | Pointer types that drive the tilt (default mouse and pen). Touch is opt-in because a finger moving over a card usually means scrolling. |
| reducedMotion | ReducedMotion | "user" | Reduced-motion policy (default "user": follow prefers-reduced-motion). |
| reverse | boolean | false | Invert the inward default: the region under the pointer comes forward (default false). |
| scale | number | — | Scale while the pointer or keyboard focus is on the element (default 1, range 0.5–2). |
| spring | SpringOptions | — | Spring used to follow the pointer and to return to rest. |
H04 · Magnetic pull
magnetic moves the element towards the pointer: strength (0.35) is the fraction of the distance and max (12 px) the limit. Decorative and pointer only; the hit area keeps the original box.
- Import
@neshel-ui/animations/hover- API
magnetic, Hover- Stylesheet
- none needed
- Reduced motion
off— no motion at all- Performance
- Transform and opacity, one write per frame through the shared scheduler; no layout work per frame.
"use client";
import { Hover, magnetic } from "@neshel-ui/animations/hover";
import { Button } from "@neshel-ui/components";
export default function H04Example() {
return (
<div className="p-8">
<Hover preset={magnetic} options={{ strength: 0.5, max: 24 }} asChild>
<Button>Pulled towards the pointer</Button>
</Hover>
</div>
);
}Options: MagneticOptions
MagneticOptions
H04 — Magnetic pull: the element follows the pointer a little (transform layer, spring).
| Prop | Type | Default | Description |
|---|---|---|---|
| disabled | boolean | — | Turn the effect off and return to rest. |
| max | number | — | Largest displacement in px (0–64, default 12). |
| pointerTypes | readonly HoverPointerType[] | — | Pointer types that activate the effect (default mouse and pen; touch is opt-in). |
| reducedMotion | ReducedMotion | "user" | Reduced-motion policy (default "user"). |
| spring | SpringOptions | SpringPreset | "snappy" | Spring of the transition (default "snappy"). |
| strength | number | — | Share of the pointer offset followed (0–1, default 0.35). |
H05 · Spotlight
spotlight paints a radial light that follows the pointer: color, size (240 px) and intensity (0.22). Under reduced motion the light is centred and does not follow.
- Import
@neshel-ui/animations/hover- API
spotlight, Hover- Stylesheet
@neshel-ui/animations/hover.css- Reduced motion
static— the decoration or content stays still- Performance
- Repaints the element (colour, gradient, clip, mask, blur or stroke) while it runs; keep the area small.
"use client";
import "@neshel-ui/animations/hover.css";
import { Hover, spotlight } from "@neshel-ui/animations/hover";
export default function H05Example() {
return (
<Hover preset={spotlight} options={{ size: 200, intensity: 0.35 }} asChild>
<a
href="#h05"
className="rounded-xl border border-neshel-border bg-neshel-surface p-6 text-neshel-surface-foreground block max-w-sm py-12"
>
A light follows the pointer
</a>
</Hover>
);
}Options: SpotlightOptions
SpotlightOptions
H05 — Spotlight: a radial highlight that follows the pointer on the decor layer.
| Prop | Type | Default | Description |
|---|---|---|---|
| color | string | — | Highlight colour (default white). |
| disabled | boolean | — | Turn the effect off and return to rest. |
| intensity | number | — | Strength of the highlight (0–1, default 0.22). |
| pointerTypes | readonly HoverPointerType[] | — | Pointer types that activate the effect (default mouse and pen; touch is opt-in). |
| reducedMotion | ReducedMotion | "user" | Reduced-motion policy (default "user"). |
| size | number | — | Radius in px (40–1000, default 240). |
| spring | SpringOptions | SpringPreset | "snappy" | Spring of the transition (default "snappy"). |
H06 · Border sweep
borderSweep runs a gradient along the border while active: width (2 px), two colors and duration (3000 ms). It uses the ::after layer, so it coexists with effects that use ::before.
- Import
@neshel-ui/animations/hover- API
borderSweep, Hover- Stylesheet
@neshel-ui/animations/hover.css- Reduced motion
static— the decoration or content stays still- Performance
- The package stylesheet renders it on layers owned by the package; your element gets no transition or animation.
"use client";
import "@neshel-ui/animations/hover.css";
import { borderSweep, Hover } from "@neshel-ui/animations/hover";
export default function H06Example() {
return (
<Hover preset={borderSweep} options={{ width: 2, duration: 2400 }} asChild>
<a
href="#h06"
className="rounded-xl border border-neshel-border bg-neshel-surface p-6 text-neshel-surface-foreground inline-block"
>
A gradient runs along the border
</a>
</Hover>
);
}Options: BorderSweepOptions
BorderSweepOptions
H06 — Border gradient sweep: a rotating conic gradient ring on the ::after layer.
| Prop | Type | Default | Description |
|---|---|---|---|
| colors | readonly [string, string] | — | Two gradient colours (default indigo and pink). |
| disabled | boolean | — | Turn the effect off and return to rest. |
| duration | number | — | Duration of one turn in ms (500–20000, default 3000). |
| pointerTypes | readonly HoverPointerType[] | — | Pointer types that activate the effect (default mouse and pen; touch is opt-in). |
| reducedMotion | ReducedMotion | "user" | Reduced-motion policy (default "user"). |
| spring | SpringOptions | SpringPreset | "snappy" | Spring of the transition (default "snappy"). |
| width | number | — | Ring width in px (1–8, default 2). |
H07 · Underline grow
underline draws a line under the element: thickness (2 px), color and origin (left, center or right). In running text keep the native link underline; colour alone does not identify a link.
- Import
@neshel-ui/animations/hover- API
underline, Hover- Stylesheet
@neshel-ui/animations/hover.css- Reduced motion
instant— the end state appears at once- Performance
- The package stylesheet renders it on layers owned by the package; your element gets no transition or animation.
"use client";
import "@neshel-ui/animations/hover.css";
import { Hover, underline } from "@neshel-ui/animations/hover";
export default function H07Example() {
return (
<Hover preset={underline} options={{ thickness: 2, origin: "left" }} asChild>
<a href="#h07" className="inline-block pb-1">
Read the case study
</a>
</Hover>
);
}Options: UnderlineOptions
UnderlineOptions
H07 — Underline grow: a bar that grows along the bottom edge (decor layer).
| Prop | Type | Default | Description |
|---|---|---|---|
| color | string | currentColor | Bar colour (default currentColor). |
| disabled | boolean | — | Turn the effect off and return to rest. |
| origin | "left" | "center" | "right" | "left" | Where the bar grows from (default "left"; logical start/end are not mirrored in RTL). |
| pointerTypes | readonly HoverPointerType[] | — | Pointer types that activate the effect (default mouse and pen; touch is opt-in). |
| reducedMotion | ReducedMotion | "user" | Reduced-motion policy (default "user"). |
| spring | SpringOptions | SpringPreset | "snappy" | Spring of the transition (default "snappy"). |
| thickness | number | — | Bar thickness in px (1–8, default 2). |
H08 · Media zoom
mediaZoom scales the media inside a frame: scale (1.08, up to 2). The target is the child with data-neshel-media, or the first child, and the frame clips it.
- Import
@neshel-ui/animations/hover- API
mediaZoom, Hover- Stylesheet
@neshel-ui/animations/hover.css- Reduced motion
static— the decoration or content stays still- Performance
- Transform and opacity, one write per frame through the shared scheduler; no layout work per frame.
Loading the example…
"use client";
import "@neshel-ui/animations/hover.css";
import { Hover, mediaZoom } from "@neshel-ui/animations/hover";
import { picture } from "./picture";
export default function H08Example() {
return (
<Hover
preset={mediaZoom}
options={{ scale: 1.15 }}
className="w-80 max-w-full overflow-hidden rounded-xl"
>
<img src={picture("Zoom", 210, 260)} alt="Blue gradient" width={640} height={400} />
</Hover>
);
}Options: MediaZoomOptions
MediaZoomOptions
H08 — Media zoom inside frame: the frame clips; its media child scales (child transform layer).
| Prop | Type | Default | Description |
|---|---|---|---|
| disabled | boolean | — | Turn the effect off and return to rest. |
| pointerTypes | readonly HoverPointerType[] | — | Pointer types that activate the effect (default mouse and pen; touch is opt-in). |
| reducedMotion | ReducedMotion | "user" | Reduced-motion policy (default "user"). |
| scale | number | — | Zoom factor (1–2, default 1.08). |
| spring | SpringOptions | SpringPreset | "snappy" | Spring of the transition (default "snappy"). |
H09 · Pointer parallax
parallax moves layers by different amounts with the pointer. Mark them with data-neshel-depth between −2 and 2; strength (16 px) is the amplitude. Decorative and pointer only.
- Import
@neshel-ui/animations/hover- API
parallax, Hover- Stylesheet
- none needed
- Reduced motion
off— no motion at all- Performance
- Transform and opacity, one write per frame through the shared scheduler; no layout work per frame.
Two layers, two depths
"use client";
import { Hover, parallax } from "@neshel-ui/animations/hover";
export default function H09Example() {
return (
<Hover
preset={parallax}
options={{ strength: 24 }}
className="relative grid h-48 max-w-md place-items-center overflow-hidden rounded-xl bg-neshel-muted"
>
<div
data-neshel-depth="-1"
className="absolute size-32 rounded-full bg-neshel-accent"
aria-hidden="true"
/>
<p
data-neshel-depth="1"
className="rounded-xl border border-neshel-border bg-neshel-surface p-6 text-neshel-surface-foreground relative"
>
Two layers, two depths
</p>
</Hover>
);
}Options: ParallaxOptions
ParallaxOptions
H09 — Pointer parallax layers: children with data-neshel-depth move by depth (transform layers).
| Prop | Type | Default | Description |
|---|---|---|---|
| disabled | boolean | — | Turn the effect off and return to rest. |
| pointerTypes | readonly HoverPointerType[] | — | Pointer types that activate the effect (default mouse and pen; touch is opt-in). |
| reducedMotion | ReducedMotion | "user" | Reduced-motion policy (default "user"). |
| spring | SpringOptions | SpringPreset | "snappy" | Spring of the transition (default "snappy"). |
| strength | number | — | Displacement in px at depth 1 and the box edge (0–100, default 16). |
H10 · Shine sweep
shine crosses the element once with a band of light each time it becomes active: color, angle (110°) and duration (700 ms). Nothing is drawn under reduced motion.
- Import
@neshel-ui/animations/hover- API
shine, Hover- Stylesheet
@neshel-ui/animations/hover.css- Reduced motion
static— the decoration or content stays still- Performance
- The package stylesheet renders it on layers owned by the package; your element gets no transition or animation.
"use client";
import "@neshel-ui/animations/hover.css";
import { Hover, shine } from "@neshel-ui/animations/hover";
export default function H10Example() {
return (
<Hover preset={shine} options={{ angle: 110, duration: 800 }} asChild>
<a
href="#h10"
className="rounded-xl border border-neshel-border bg-neshel-surface p-6 text-neshel-surface-foreground inline-block"
>
A glare crosses the card
</a>
</Hover>
);
}Options: ShineOptions
ShineOptions
H10 — Shine / glare sweep: one highlight sweep across the decor layer on each activation.
| Prop | Type | Default | Description |
|---|---|---|---|
| angle | number | — | Gradient angle in degrees (0–360, default 110). |
| color | string | — | Highlight colour (default translucent white). |
| disabled | boolean | — | Turn the effect off and return to rest. |
| duration | number | — | Sweep duration in ms (100–5000, default 700). |
| pointerTypes | readonly HoverPointerType[] | — | Pointer types that activate the effect (default mouse and pen; touch is opt-in). |
| reducedMotion | ReducedMotion | "user" | Reduced-motion policy (default "user"). |
H11 · Cursor follower
<CursorFollower> renders a decorative, aria-hidden circle that follows a fine pointer inside its area with a spring (size, spring, blend). The real cursor stays visible.
- Import
@neshel-ui/animations/hover- API
cursorFollower, CursorFollower- Stylesheet
@neshel-ui/animations/hover.css- Reduced motion
off— no motion at all- Performance
- Transform and opacity, one write per frame through the shared scheduler; no layout work per frame.
"use client";
import "@neshel-ui/animations/hover.css";
import { CursorFollower } from "@neshel-ui/animations/hover";
export default function H11Example() {
return (
<CursorFollower
size={48}
className="grid h-40 max-w-md place-items-center rounded-xl bg-neshel-muted"
>
Move a mouse or pen here
</CursorFollower>
);
}Options: CursorFollowerOptions
CursorFollowerOptions
| Prop | Type | Default | Description |
|---|---|---|---|
| blend | boolean | — | Blend with the content (mix-blend-mode: difference, default false). |
| disabled | boolean | — | Turn the effect off and return to rest. |
| pointerTypes | readonly ("mouse" | "pen")[] | — | Pointer types that show the follower (default mouse and pen; touch is not supported). |
| reducedMotion | ReducedMotion | "user" | Reduced-motion policy (default "user"). |
| size | number | — | Diameter in px (4–160, default 28). |
| spring | SpringOptions | SpringPreset | "snappy" | Spring of the transition (default "snappy"). |