URL Input

URL Input is a copy-paste React component that stops lookalike or broken link saved 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/url-input
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

StopsLookalike or broken link saved

Was this component page useful?

How do I install URL Input?

pnpm dlx shadcn@latest add @bollard/url-input

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

How do I use URL Input in React?

url-input-usage.tsx
import { analyzeUrl, UrlInput } from "@/components/ui/url-input"

<UrlInput label="Link to share" defaultValue={shared} onUrlChange={setSaved} />

What input mistakes does URL Input catch?

  • Missing scheme, with https:// added
  • http links, with a switch to https
  • Lookalike (homoglyph) hostnames, shown decoded from xn-- punycode
  • A user@host prefix that disguises the real site
  • Typo'd top-level domains (.con, .cmo)
  • Tracking parameters (utm_*, fbclid…), stripped in one tap

What props does URL Input accept?

UrlInput props
PropTypeDefault
label

Visible label.

string"Website"
hint

Helper text shown under the field while there is nothing to warn about.

string—
value

Controlled text.

string—
defaultValue

Initial text when uncontrolled.

string""
onValueChange

Called with the raw text on every change, including one-tap fixes.

(value: string) => void—
onUrlChange

Called with the normalized absolute URL, or `null` while the text isn't a usable address.

(url: string | null) => void—
trackingParams

Parameter names treated as tracking; `utm_*` style prefixes are supported.

string[]DEFAULT_TRACKING_PARAMS
removeTrackingLabel

Label of the fix that strips tracking parameters.

string"Remove tracking"
useHttpsLabel

Label of the fix that upgrades http:// to https://.

string"Use https"
messages

Override any other visible string.

Partial<typeof URL_INPUT_MESSAGES>—

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

How is URL Input accessible?

  • Visible <label>; aria-invalid and hints via aria-describedby
  • Hints and fixes in a polite live region
  • Fix buttons have text labels

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

What are the limitations and server boundaries?

This is a UX guard rail. Enforce on the server: Validate and normalise URLs server-side, and check them against allowlists or safe-browsing services where it matters.

  • Does not fetch the URL or check that it resolves or is safe
  • Lookalike detection covers common Cyrillic/Greek confusables
  • The tracking list is a starter set you can extend

What expensive mistakes does URL Input stop?

Lookalike or broken link saved

Also known as

url · link · website field · https · utm strip · homograph · link input · profile link

Field type

What dependencies does URL Input require?

URL Input facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameURL Input
Registry identifier@bollard/url-input
Install commandnpx shadcn@latest add @bollard/url-input
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-10-16
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 URL Input

What form validation mistake does URL Input catch?

URL Input prevents lookalike or broken link saved. Catches broken, insecure and disguised links: missing https, lookalike hostnames, user@host tricks, typo'd endings and tracking clutter. Catches: Missing scheme, with https:// added, http links, with a switch to https, Lookalike (homoglyph) hostnames, shown decoded from xn-- punycode, A user@host prefix that disguises the real site, Typo'd top-level domains (.con, .cmo), Tracking parameters (utm_*, fbclid…), stripped in one tap. Limitation: validate url-input schemas on backend.

How do I install url-input with shadcn?

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

What props customize URL Input?

URL Input accepts `label`, `hint`, `value`, `defaultValue`, `onValueChange`. Configures url, link, website field behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of url-input?

Does not fetch the URL or check that it resolves or is safe. Lookalike detection covers common Cyrillic/Greek confusables. The tracking list is a starter set you can extend Server requirement: Validate and normalise URLs server-side, and check them against allowlists or safe-browsing services where it matters.

How does URL Input meet accessibility guidelines?

Visible <label>; aria-invalid and hints via aria-describedby. Hints and fixes in a polite live region. Fix buttons have text labels. Minimizes errors: url missing https, phishing lookalike domain.

Which components pair with URL Input?