VisorVisor
ComponentsOverlay

Hover Card

A card that appears when hovering over a trigger element. Built on Radix UI with configurable delay, alignment, and side positioning.

Basic Hover Card

Side Positioning

Use the side prop on HoverCardContent to control which side of the trigger the card appears on.

Rich Content

Hover cards can contain structured content such as user profiles, previews, or metadata.

Open/Close Delay

Control how quickly the card appears and disappears with openDelay and closeDelay (in milliseconds) on the root HoverCard component.

<HoverCard openDelay={200} closeDelay={100}>
  <HoverCardTrigger asChild>
    <a href="#">Hover me</a>
  </HoverCardTrigger>
  <HoverCardContent>
    <p>Appears after 200ms, disappears after 100ms.</p>
  </HoverCardContent>
</HoverCard>

Installation

npx visor add hover-card

This copies two files into your project:

  • components/ui/hover-card/hover-card.tsx — the component
  • components/ui/hover-card/hover-card.module.css — the styles

Usage

import {
  HoverCard,
  HoverCardTrigger,
  HoverCardContent,
} from '@/components/ui/hover-card/hover-card';

export default function Example() {
  return (
    <HoverCard>
      <HoverCardTrigger asChild>
        <a href="#">Hover me</a>
      </HoverCardTrigger>
      <HoverCardContent>
        <p>Card content here.</p>
      </HoverCardContent>
    </HoverCard>
  );
}

API Reference

HoverCardProps

PropTypeDefaultDescription
openbooleanControlled open state of the hover card.
onOpenChange(open: boolean) => voidCallback when the open state changes.
openDelaynumber700Milliseconds to wait before opening on hover.
closeDelaynumber300Milliseconds to wait before closing after hover ends.
side'top' | 'right' | 'bottom' | 'left''bottom'Side of the trigger the card appears on (on HoverCardContent).
align'start' | 'center' | 'end''center'Alignment of the card relative to the trigger (on HoverCardContent).
sideOffsetnumber4Distance in pixels between the trigger and the card (on HoverCardContent).
classNamestringAdditional CSS class names to merge onto HoverCardContent.

Sub-components

ComponentElementPurpose
HoverCardRootContext provider (wraps Radix HoverCard.Root)
HoverCardTriggerAny elementThe element that triggers the card on hover
HoverCardContentFloating panelThe card container; accepts side, align, and sideOffset

Accessibility

  • Built on Radix UI HoverCard — the content region is not focusable by default. Use HoverCard for supplemental, non-critical information only.
  • For content that must be keyboard-accessible (e.g., links, buttons inside the card), use Popover instead.
  • The trigger should be a focusable element (link or button) so keyboard users can navigate to the associated content in another way.
  • Screen readers are not guaranteed to announce hover card content; treat it as decorative preview text.