VibeUI
ComponentsDocs
VibeUI

Components with taste, that you own. Copy the source, retint the tokens, keep every line.

Library

  • All components
  • Signature pieces
  • Text effects
  • Footers

Docs

  • Introduction
  • Installation
  • Theming
  • CLI

Project

  • GitHub
  • Agents and MCP
  • Issues
  • MIT license
© 2026 VibeUI · MIT licensed
  1. Components
  2. Hover effects
  3. Hover Image

Hover Image

Inline link that reveals a floating image preview following the cursor.

Hover effectsClient component

Hover atelier or paper grain for a floating preview.

Install

bash
npx @agents-npm-packages/vibeui add hover-image --dir ./src/components/ui

Import

tsx
import { HoverImage } from "@/components/ui/hover-image"

API

Generated from the component's TypeScript types, so it always matches the source. * marks a required prop.

<HoverImage>

PropTypeDefaultDescription
label*string—Visible label.
src*string—Image URL.
classNamestring—Extra classes, merged with the component's own.

Source

src/components/ui/hover-image.tsx
"use client";

import * as React from "react";
import { cn } from "@/lib/utils";

/** Inline link that reveals a floating image preview following the cursor. */
export function HoverImage({
  label,
  src,
  className,
}: {
  label: string;
  src: string;
  className?: string;
}) {
  const card = React.useRef<HTMLSpanElement>(null);
  const [show, setShow] = React.useState(false);

  return (
    <span
      className={cn("inline-block", className)}
      onMouseEnter={() => setShow(true)}
      onMouseLeave={() => setShow(false)}
      onMouseMove={(e) => {
        const el = card.current;
        if (!el) return;
        el.style.transform = `translate(${e.clientX + 18}px, ${e.clientY + 18}px)`;
      }}
    >
      <span className="cursor-default border-b border-dashed border-faint font-medium text-ink transition-colors hover:border-accent hover:text-accent">
        {label}
      </span>
      <span
        ref={card}
        aria-hidden
        className={cn(
          "pointer-events-none fixed left-0 top-0 z-50 h-[130px] w-[190px] overflow-hidden rounded-md border border-line bg-surface shadow-lift transition-opacity duration-200",
          show ? "opacity-100" : "opacity-0",
        )}
      >
        {/* eslint-disable-next-line @next/next/no-img-element */}
        <img src={src} alt="" className="size-full object-cover" />
      </span>
    </span>
  );
}

Exports HoverImage. Peer dependencies: clsx, tailwind-merge.

PreviousHover IconNextHover Image List