---
title: "Cursor Magnifier"
description: "A glass lens follows the pointer over one section and magnifies what is under it. It stretches with the move and wobbles when it stops."
url: https://gelatinui.com/components/cursor-magnifier
markdown_url: https://gelatinui.com/components/cursor-magnifier.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/cursor-magnifier"
version: "2026-11-18"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Cursor Magnifier

> A glass lens follows the pointer over one section and magnifies what is under it. It stretches with the move and wobbles when it stops.

Page: https://gelatinui.com/components/cursor-magnifier

## When to use it

Best for: A photo or a dense block where people want to look closer without leaving the page.

- Put the picture or text in `CursorMagnifierContent`, and place `CursorMagnifierLens` after it.
- Pass a 2× `Image` as the children of the lens for a sharp zoom.
- Give the root `tabIndex={0}` and an `aria-label`, so the keyboard can show and move the lens.
- Set `--cursor-magnifier-fill` on the root when the surface is not the page background.

## When not to use it

- For a full view of a photo that people open and close, use a [Lightbox](https://gelatinui.com/components/lightbox.md).
- For a plain picture with a loading and an error state, use [Image](https://gelatinui.com/components/image.md).

## Notes for agents

- The parts are `CursorMagnifier`, `CursorMagnifierContent`, and `CursorMagnifierLens`. Use all three.
- With no lens children, the lens shows an `inert` copy of the Content. Do not put `id` values in the Content: the copy repeats them.
- A video or a live canvas in the Content does not stay in step with its copy.
- `diameter` is 24 or more, `zoom` is 1 to 8, and `wobble` and `refraction` are 0 to 1.5.
- `paused` keeps the lens where it is. The cursor engine stops off screen and in a hidden tab.
- A browser with no SVG filter support on HTML shows a flat zoom, with no bend at the rim.

## Anatomy

```text
CursorMagnifier
├─ CursorMagnifierContent (0..n)
└─ CursorMagnifierLens (0..n)
```

## API reference

### CursorMagnifier

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `paused` | `boolean` | false | True keeps the lens where it is and stops the follow, the keys, and the finger. Default false. |

### CursorMagnifierContent

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### CursorMagnifierLens

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `diameter` | `number` | 168 | The width and height of the lens, in px, 24 or more. Default 168. |
| `zoom` | `number` | 1.75 | How much the lens magnifies, from 1 to 8. Default 1.75. |
| `wobble` | `number` | 1 | How much the lens stretches and wobbles, from 0 (a rigid lens) to 1.5. Default 1. |
| `refraction` | `number` | 1 | How much the rim bends the picture, from 0 (flat) to 1.5. Default 1. |
| `children` | `ReactNode` |  | A sharper copy for the lens, at the size of the Content (a 2× photo). Without children the lens shows a copy of the Content. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| CursorMagnifier | `cursor-magnifier` |  |  |  |
| CursorMagnifierContent | `cursor-magnifier-content` |  |  |  |
| CursorMagnifierLens | `cursor-magnifier-lens` |  | `--background`, `--cursor-magnifier-fill` |  |

## Usage

Put the content and the lens inside the root. The lens magnifies a copy of the content.

The sample also uses `image`, which this add does not write. One command adds them with this item:

```bash
npx shadcn@latest add @gelatin-ui-pro/cursor-magnifier @gelatin-ui/image
```

```tsx title="product-detail.tsx"
import {
  CursorMagnifier,
  CursorMagnifierContent,
  CursorMagnifierLens,
} from "@/components/pro/cursor/cursor-magnifier";
import { Image } from "@/components/ui/image";

export function ProductDetail() {
  return (
    <CursorMagnifier
      tabIndex={0}
      aria-label="Misty hill at sunrise, with a magnifier"
      className="w-full rounded-2xl bg-muted"
    >
      <CursorMagnifierContent>
        <Image
          src="/example-assets/hills-sunrise-wide.webp"
          alt="A lone tree on a misty hill at sunrise"
          width={1280}
          height={600}
          preload
          className="block aspect-[32/15] w-full"
        />
      </CursorMagnifierContent>
      <CursorMagnifierLens diameter={168} zoom={2} />
    </CursorMagnifier>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui-pro/cursor-magnifier
```

It adds 24 registry items: 23 files, 3838 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `clsx`, `motion`, `tailwind-merge`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Image](https://gelatinui.com/components/image.md)
- [Lightbox](https://gelatinui.com/components/lightbox.md)
- [Magnetic](https://gelatinui.com/components/magnetic.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Tab | Moves to the root when it has `tabIndex={0}` and shows the lens in the middle. A focused control in the Content pulls the lens to it. |
| Arrow keys | Move the lens 24 px while the root has focus. |
| Shift + Arrow keys | Move the lens 96 px while the root has focus. |
| Escape | Hides the lens. |

## Accessibility

The root is a `section`. Give it an `aria-label` when it takes keyboard focus.

The lens is `aria-hidden`, and its copy of the Content is `inert`, so screen readers and Tab reach the content only once.

On touch, press and drag: the lens sits above the finger, and a vertical swipe still scrolls the page.

## Motion

| Part | Motion |
| --- | --- |
| Follow | follow · spring of 0.45s with a soft bounce, so the lens lags and settles |
| Stretch and wobble | follow · spring of 0.5s with a strong bounce, up to 1.22× along the move |
| Show and hide | follow · spring of 0.35s, the lens grows from 60% and fades |
| Stretch turn | follow · spring of 0.2s with no bounce, so a new direction does not swing past |
