Code Input

Code Input is a copy-paste React component that stops smart quotes break a pasted command 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/code-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

StopsSmart quotes break a pasted command

Was this component page useful?

How do I install Code Input?

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

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

How do I use Code Input in React?

code-input-usage.tsx
import { CodeInput } from "@/components/ui/code-input"

<CodeInput
  label="Deploy command (pasted from a doc)"
  rows={4}
  defaultValue={"git push —force origin main\nexport API_KEY=“sk_live_51H\u200b8xQ”"}
/>

What input mistakes does Code Input catch?

  • Curly quotes that break shell commands and JSON
  • En/em dashes where -- or - was meant (—force → --force)
  • Ellipsis characters and invisible characters
  • Invalid JSON, with the parse error (json prop)

What props does Code Input accept?

CodeInput props
PropTypeDefault
label

Visible label.

string"Command"
hint

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

string—
value

Controlled contents.

string—
defaultValue

Initial contents when uncontrolled.

string""
onValueChange

Called on every edit, including the one-tap fix.

(value: string) => void—
json

Validate the contents as JSON and point at the line and column of the error.

booleanfalse
validJsonMessage

Text shown when the JSON parses. Same as `messages.validJson`.

string—
messages

Reword or translate any message.

Partial<typeof CODE_INPUT_MESSAGES>—

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

How is Code Input accessible?

  • Visible <label>; aria-invalid and aria-describedby to an aria-live="polite" hint
  • Each issue lists its line and column in text
  • Fix button has visible text

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

What are the limitations and server boundaries?

  • Fixes are character substitutions; it doesn't check that the command or config is right
  • Intentional typographic characters inside strings may be flagged

What expensive mistakes does Code Input stop?

Smart quotes break a pasted command

Also known as

code input · command · terminal · json · smart quotes · autocorrect off · api key · snippet

Field type

What dependencies does Code Input require?

Code Input facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameCode Input
Registry identifier@bollard/code-input
Install commandnpx shadcn@latest add @bollard/code-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 Code Input

What form validation mistake does Code Input catch?

Code Input prevents smart quotes break a pasted command. A code field that turns off autocorrect and catches smart quotes, long dashes and hidden characters, so pasted commands and JSON don't fail invisibly. Catches: Curly quotes that break shell commands and JSON, En/em dashes where -- or - was meant (—force → --force), Ellipsis characters and invisible characters, Invalid JSON, with the parse error (json prop). Limitation: validate code-input schemas on backend.

How do I install code-input with shadcn?

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

What props customize Code Input?

Code Input accepts `label`, `hint`, `value`, `defaultValue`, `onValueChange`. Configures code input, command, terminal behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of code-input?

Fixes are character substitutions; it doesn't check that the command or config is right. Intentional typographic characters inside strings may be flagged Server requirement: backend verification for code-input.

How does Code Input meet accessibility guidelines?

Visible <label>; aria-invalid and aria-describedby to an aria-live="polite" hint. Each issue lists its line and column in text. Fix button has visible text. Minimizes errors: smart quotes in code, autocorrect breaks command.

Which components pair with Code Input?