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 (hover preview shows on focus)

Screen Readers

  • Preview popup is properly labeled via aria-describedby

Additional

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

Localization

Translatable Content

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