Connection String Input

Connection String Input is a copy-paste React component that stops database url leaks or skips tls 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/connection-string-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

StopsDatabase URL leaks or skips TLS

Was this component page useful?

How do I install Connection String Input?

pnpm dlx shadcn@latest add @bollard/connection-string-input

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

How do I use Connection String Input in React?

connection-string-input-usage.tsx
import { ConnectionStringInput } from "@/components/ui/connection-string-input"

return <ConnectionStringInput environment="production" defaultValue={'DATABASE_URL="postgres://app:Tr0ub4dor@3#x@db.prod.example.com:5432/shop"'} />

What input mistakes does Connection String Input catch?

  • Unencoded @, #, / or % in the password, naming the host a strict parser would use
  • Missing, weak or misspelled sslmode, and sslrootcert=system with a weaker mode
  • localhost in production and a port that belongs to another database
  • redis:// and MongoDB URLs without TLS (including mongodb+srv with tls=false)
  • Quotes or KEY= pasted from a .env file

What props does Connection String Input accept?

ConnectionStringInput props
PropTypeDefault
value

Controlled connection URL.

string—
defaultValue

Initial connection URL when uncontrolled.

string""
onValueChange

Called with the text on every edit or fix.

(value: string) => void—
environment

Where this URL will be used. Production turns localhost and missing TLS into problems.

DbEnvironment"production"
label

Visible label; shorthand for `messages.label`.

string—
messages

Every visible string. `{host}`, `{chars}`, `{mode}` and the other placeholders are filled in.

Partial<ConnectionStringInputMessages>—
name

Form field name. The real (unmasked) URL is submitted through a hidden input, since the visible one is masked when blurred.

string—

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

How is Connection String Input accessible?

  • Visible <label>; aria-invalid and aria-describedby to a role="status" summary
  • Readback is a section labelled by its heading
  • Copy-masked button announces "Copied" in an aria-live="polite" span
  • After a fix, focus moves to the next fix or back to the field

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: Keep connection strings in a secrets manager and enforce TLS on the database server itself.

  • Parses the URL text; it doesn't try to connect or check credentials
  • Covers PostgreSQL (libpq), MySQL, MongoDB and Redis URL forms; other drivers may parse differently
  • Masking is visual: the full password is still in the value you receive

What validation rules apply to Connection String Input?

Rules last verified:

Informational. Checked libpq sslmode values (prefer is the default) and that sslrootcert=system requires verify-full. MongoDB, MySQL and Redis conventions were not re-checked. Copied components don't update themselves, so re-check after rule changes (see updating a component).

What expensive mistakes does Connection String Input stop?

Database URL leaks or skips TLS

Also known as

database url · DATABASE_URL · postgres uri · mongodb+srv · redis url · dsn · sslmode · connection string

Field type

What dependencies does Connection String Input require?

Connection String Input facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameConnection String Input
Registry identifier@bollard/connection-string-input
Install commandnpx shadcn@latest add @bollard/connection-string-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 Connection String Input

What form validation mistake does Connection String Input catch?

Connection String Input prevents database URL leaks or skips TLS. Masks a database URL's password and reads back the host, user and TLS mode the driver will actually use, so it doesn't fail or connect insecurely. Catches: Unencoded @, #, / or % in the password, naming the host a strict parser would use, Missing, weak or misspelled sslmode, and sslrootcert=system with a weaker mode, localhost in production and a port that belongs to another database, redis:// and MongoDB URLs without TLS (including mongodb+srv with tls=false), Quotes or KEY= pasted from a .env file. Limitation: validate connection-string-input schemas on backend.

How do I install connection-string-input with shadcn?

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

What props customize Connection String Input?

Connection String Input accepts `value`, `defaultValue`, `onValueChange`, `environment`, `label`. Configures database url, DATABASE_URL, postgres uri behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of connection-string-input?

Parses the URL text; it doesn't try to connect or check credentials. Covers PostgreSQL (libpq), MySQL, MongoDB and Redis URL forms; other drivers may parse differently. Masking is visual: the full password is still in the value you receive Server requirement: Keep connection strings in a secrets manager and enforce TLS on the database server itself.

How does Connection String Input meet accessibility guidelines?

Visible <label>; aria-invalid and aria-describedby to a role="status" summary. Readback is a section labelled by its heading. Copy-masked button announces "Copied" in an aria-live="polite" span. After a fix, focus moves to the next fix or back to the field. Minimizes errors: database url wont connect, special character in db password.

Which components pair with Connection String Input?