GitHub

Link Preview

Preview card that appears when hovering over links

Basic Usage

Loading...

Installation

pnpm add @corew500/ui

Usage

import { LinkPreview } from "@corew500/ui/link-preview"

<LinkPreview>Content</LinkPreview>

Variants

linkPreviewVariants

AxisValuesDefault
variant
defaultsubtle
default

API Reference

Props

PropTypeDefaultDescription
href*stringLink destination
previewLinkPreviewDataPreview data (image, title, description)
sideenumtopSide of the link to show preview
alignenumcenterAlignment relative to the link
openDelaynumber300Delay before showing preview (ms)
closeDelaynumber150Delay before hiding preview (ms)
showOnTouchenumfalseWhether to show preview on touch devices
variantenumdefault

Accessibility

Keyboard Navigation

  • Keyboard accessible: preview shows on focus, not just hover

Screen Readers

  • Preview popup is associated via `aria-describedby` (handled by Base UI PreviewCard)
  • For links where the text alone is insufficient, provide `aria-label` for additional context: `<LinkPreview href="/pricing" aria-label="View pricing plans">Pricing</LinkPreview>`

Additional

  • - Uses semantic anchor element for proper link behavior
  • Respects user motion preferences via Framer Motion

Localization

Translatable Content

  • - Link text and preview content should be pre-translated
  • Preview title and description accept localized strings