Env Paste

Shows a pasted .env file as the loader will read it, so stray quotes, a ' #' that cuts a value short or duplicate keys don't slip through.

StopsEnv value silently cut short

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/env-paste.json

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

Usage

env-paste-usage.tsx
import { EnvPaste } from "@/components/ui/env-paste"

return <EnvPaste label="Production config" environment="production" defaultValue={pasted} />

What it catches

  • Stray or curly quotes and padded values
  • An unquoted ' #' that turns the rest of the value into a comment
  • Duplicate keys (which one wins) and invalid key names
  • Empty values, and test keys in production

Props

EnvPaste props
PropTypeDefault
label

Visible label.

string"Environment variables"
environment

The environment this config is for. Enables test-key-in-production and live-key-in-development checks.

EnvTarget—
value

Controlled text.

string—
defaultValue

Initial text when uncontrolled.

string""
onValueChange

Called with the new text on every edit or fix.

(value: string) => void—
maskSecrets

Mask values whose key looks secret (keeps the sk_test_ / sk_live_ prefix visible).

booleantrue
fixAllLabel

Label of the button that applies every safe fix. `{count}` is filled in.

string"Fix {count}"
cleanText

Shown when every line parses cleanly. `{count}` is the number of variables.

string"{count} variables, no problems found."
problemsText

Shown when there are problems. `{errors}` and `{warnings}` are filled in.

string"{errors} errors, {warnings} warnings"
placeholder

Placeholder shown in the empty textarea.

string"Paste your .env here\nDATABASE_URL=postgres://…"

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

Accessibility

  • Visible <label>; aria-invalid when there are errors
  • Summary is aria-live="polite"
  • Parsed variables are a labelled list; each row can select its line in the field

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

Limitations

This is a UX guard rail. Enforce on the server: Validate required environment variables when the app starts, and keep production secrets out of shared pastes.

  • Follows common dotenv parsing; your loader may treat quotes and comments differently
  • Masking is visual; the pasted text still holds the secrets

What it stops

Env value silently cut short

Also known as

.env · dotenv · environment variables · env vars · vercel env · secrets · config · api keys

Dependencies

Pairs well with