Link Unfurl Check

Previews how a link will unfurl before you post it and catches localhost or staging links, tracking parameters and broken preview images.

StopsPosted a localhost link preview

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/link-unfurl-check.json

The files land in your project. They're yours to edit.

Usage

link-unfurl-check-usage.tsx
import { LinkUnfurlCheck, type UnfurlFetcher, type UnfurlPreview } from "@/components/ui/link-unfurl-check"

<LinkUnfurlCheck
  label="Share in #announcements"
  defaultValue="https://staging.acme.dev/blog/launch?utm_source=newsletter&utm_medium=email"
  publicOrigin="https://acme.com"
  fetchPreview={fetchPreview}
  placeholder="https://"
  delay={250}
/>

What it catches

  • localhost and staging URLs, with a swap to publicOrigin
  • Tracking parameters such as utm_*
  • Redirects, especially to a sign-in page
  • Missing or undersized preview images

Props

LinkUnfurlCheck props
PropTypeDefault
label

Visible label.

string"Link"
value

Controlled URL.

string—
defaultValue

Initial URL when uncontrolled.

string""
onValueChange

Called with the URL on every change and when a fix is applied.

(value: string) => void—
fetchPreview* (required)

Reads the page's tags, usually through your server (see `parseOpenGraph`).

UnfurlFetcher—
publicOrigin

The live origin offered in place of localhost or staging, e.g. "https://acme.com".

string—
delay

Pause in ms after typing before the page is fetched.

number500
messages

Overrides for the messages in `UNFURL_MESSAGES`.

Partial<Messages>—
previewLabel

Heading above the predicted card.

string"How it will unfurl"

* required. Also accepts the native props of <input> (className, aria-*, data-*…), passed through to it.

Accessibility

  • Visible label; input is described by the issues list
  • Issues are a polite live region with text, icons aria-hidden
  • Preview is a labelled section with aria-busy while loading

Only what the source does. Test with your own screen reader and content before shipping.

Limitations

  • Needs your server-side fetchPreview; browsers can't fetch most pages cross-origin
  • Each platform renders previews a little differently and caches them
  • Doesn't check the page content itself

What it stops

Posted a localhost link preview

Also known as

link preview · unfurl · open graph · og image · utm · localhost · slack preview · twitter card

Field type

Dependencies

Pairs well with