External Link

External Link is a copy-paste React component that stops clicked through to a phishing site before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/external-link
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsClicked through to a phishing site

Was this component page useful?

How do I install External Link?

pnpm dlx shadcn@latest add @bollard/external-link

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

How do I use External Link in React?

external-link-usage.tsx
import { ExternalLink } from "@/components/ui/external-link"

<ExternalLink href={link.href} confirm={link.confirm}>
  {link.text}
</ExternalLink>

What input mistakes does External Link catch?

  • Punycode and lookalike domains
  • Link text that names a different site than the href
  • Brand names buried in subdomains (paypal.com.example.net)
  • Raw IP addresses and plain http://

What props does External Link accept?

ExternalLink props
PropTypeDefault
href* (required)

Absolute destination URL. Same-host links render as plain links.

string—
trustedDomains

Domains people are likely to be impersonating, used for lookalike checks.

string[]DEFAULT_TRUSTED
confirm

When to stop and show the destination. "always" confirms every external link; "risky" lets clean links through untouched and only stops for ones with a warning, so trusted content (docs, your own footer) never nags.

"always" | "risky""always"
labels

Override any label.

Partial<typeof EXTERNAL_LINK_LABELS>—
warningMessages

Override any warning sentence (see `LINK_WARNING_MESSAGES`).

Partial<Record<LinkIssue["kind"], string>>—

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

How is External Link accessible?

  • Links that confirm expose aria-haspopup="dialog" and aria-expanded
  • The confirmation is role="dialog" labelled by its title; Escape closes it and returns focus to the link
  • Warnings are written in text

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

What are the limitations and server boundaries?

  • Heuristics only: a well-made phishing domain with no lookalike signals passes
  • Registrable-domain detection uses a built-in suffix list that may miss newer suffixes
  • Trusted domains are whatever you pass

What expensive mistakes does External Link stop?

Clicked through to a phishing site

Also known as

external link · phishing · leaving site · punycode · url · link warning · safe browsing · redirect

Field type

What dependencies does External Link require?

External Link facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameExternal Link
Registry identifier@bollard/external-link
Install commandnpx shadcn@latest add @bollard/external-link
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-11-15
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about External Link

What form validation mistake does External Link catch?

External Link prevents clicked through to a phishing site. Confirms off-site links with the real destination and flags lookalike, punycode or mismatched links, so people don't click through to a phishing site. Catches: Punycode and lookalike domains, Link text that names a different site than the href, Brand names buried in subdomains (paypal.com.example.net), Raw IP addresses and plain http://. Limitation: validate external-link schemas on backend.

How do I install external-link with shadcn?

Run `npx shadcn@latest add @bollard/external-link`. Sources added: registry/default/external-link/external-link.tsx. Package requirements: lucide-react.

What props customize External Link?

External Link accepts `href`, `trustedDomains`, `confirm`, `labels`, `warningMessages`. Configures external link, phishing, leaving site behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of external-link?

Heuristics only: a well-made phishing domain with no lookalike signals passes. Registrable-domain detection uses a built-in suffix list that may miss newer suffixes. Trusted domains are whatever you pass Server requirement: backend verification for external-link.

How does External Link meet accessibility guidelines?

Links that confirm expose aria-haspopup="dialog" and aria-expanded. The confirmation is role="dialog" labelled by its title; Escape closes it and returns focus to the link. Warnings are written in text. Minimizes errors: phishing link, lookalike domain.

Which components pair with External Link?