Skip to content
synccn

Hover Card

Rich preview when the pointer rests on a link.

Built and maintained by @michael

Installation

$ pnpm dlx shadcn@latest add @synccn/hover-card

First time in this project? Connect synccn with one command.

Usage

import { HoverCard } from "@/components/ui/hover-card";<HoverCard trigger={<a>@michael</a>}>…</HoverCard>

API reference

Generated from the component's TypeScript types, so it always matches the code.

HoverCard

Rich preview that appears when the pointer rests on (or keyboard focuses) the trigger.

  • triggerrequired
    React.ReactNode

    Element that opens the card.

  • openDelay
    number

    Default 300

    Milliseconds before opening.

  • closeDelay
    number

    Default 150

    Milliseconds before closing.

  • side
    "top" | "bottom"

    Default "bottom"

    Where the card appears.

  • children
    React.ReactNode

    Content to render.

  • className
    string

    Extra classes for the root element.

Dependencies

Read from the component's imports when the site builds. The CLI installs all of these for you.

Helpers

npm packages

Accessibility

  • Opens on hover and focus. Keep its content a preview; the link it's attached to should still work on its own.

From the source

Read from this component's code when the site builds, so it can't drift.

  • ARIA roles: dialog