Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

Link Preview Hover Card for Vue

Inside a sentence, the words this article open a card with the article title, a summary, and example.com.

UI library: Ark UI

The sentence is Check out this article for more information. The card titles Getting Started with React Server Components, adds a short summary, and shows example.com.

It fits posts and docs where readers should judge a link first. If the preview must open on a tap, use a Popover. In Vue, Ark UI does not fetch the page. This preview is written in the file.

Preview

Preview width

Installation

MCP · Pro
Make your AI a shadcn expert
Your agent installs components, builds pages and restyles your app from one prompt, in Claude Code, Cursor or VS Code.
Part of Pro

Anatomy

Hover Card anatomy: trigger, positioner, arrow, content

Usage

<p class="text-muted-foreground text-sm">
  Check out{{ " " }}<HoverCard><HoverCardTrigger :asChild="true"><a class="font-medium text-foreground underline underline-offset-4" href="#">this article</a></HoverCardTrigger><HoverCardContent class="w-80"><div class="flex flex-col gap-2"><h4 class="font-semibold text-sm">Getting Started with React Server Components</h4><p class="text-muted-foreground text-sm">Learn how to build modern React applications with server components, streaming, and Suspense.</p><div class="flex items-center gap-2 text-muted-foreground text-xs"><ExternalLinkIcon aria-hidden="true" class="size-3" />example.com</div></div></HoverCardContent></HoverCard>{{ " " }}for more information.
</p>

FAQ

What is in the card?

The article's title, a muted summary and a row with an external-link icon and example.com.

How is the inline link made the trigger?

HoverCardTrigger takes as-child, and the demo passes the inline link.

Where does the preview come from?

In the demo it is written in the file. In an app, load the page's title and description, for example from its Open Graph tags, and render them in the card.

How wide is the card?

w-80 on the card, for the extra content. The class is on HoverCardContent.

How do I change how fast the card opens and closes?

The card opens a moment after the pointer rests on the trigger and stays up long enough for the pointer to move into it. Both delays are in milliseconds. Set openDelay and closeDelay on HoverCard; they default to 10 and 100. positioning picks another side than the bottom.

Does the card open from the keyboard and on touch screens?

Focusing the link opens the card, moving focus away or pressing Escape closes it. Touch screens have no hover, so keep what matters reachable elsewhere, or use a Popover when the card has to open on a tap.

API Reference

Hover Card

Sets asChild. The rest is on the Hover Card page.