Name Input

Name Input is a copy-paste React component that stops names saved in caps or swapped 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/name-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

StopsNames saved in caps or swapped

Was this component page useful?

How do I install Name Input?

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

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

How do I use Name Input in React?

name-input-usage.tsx
import { NameFields, NameInput } from "@/components/ui/name-input"

<NameInput label="Account holder" defaultValue="PRIYA sharma" />

What input mistakes does Name Input catch?

  • ALL CAPS or all-lowercase names
  • Digits and doubled spaces
  • First and last names swapped (from common-name lists)
  • A full name typed into one box: offers to split
  • Re-casing that respects Mc/Mac, O', particles and hyphens

What props does Name Input accept?

NameInput props
PropTypeDefault
label

Visible label.

string"Full name"
value

Controlled value.

string—
defaultValue

Initial value when uncontrolled.

string""
onValueChange

Called with the value exactly as typed. Nothing is ever rewritten without a tap.

(value: string) => void—
hint

Helper text shown while there is nothing to point out.

string—
surname

The field holds only a family name, so a leading particle stays lower case ("van der Berg").

booleanfalse
delay

Pause in ms before suggestions appear while typing. Leaving the field shows them at once.

number700
capsMessage

Shown when the name is in capitals.

string"Typed in capitals?"
lowerMessage

Shown when the name is all lowercase.

string"Names usually start with a capital."
digitsMessage

Shown when a name has digits; receives them, e.g. "2".

(digits: string) => string(digits) => `Names rarely contain digits (${digits}).`
spacesMessage

Shown for doubled or stray spaces.

string"There's an extra space."
fixLabel

Fix button text; receives the suggested name.

(fix: string) => string(fix) => `Use “${fix}”`
keepLabel

Accessible label of the button that keeps the name as typed.

string"Keep it as typed"

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

How is Name Input accessible?

  • Visible label; input is described by a polite hint region
  • Warnings appear after a pause while typing
  • Keep button has an aria-label and title; icons are aria-hidden

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

What are the limitations and server boundaries?

  • Casing and swap lists are English/Western-centric; they can be wrong for other naming traditions
  • Only suggests; some people really write their name in capitals or lowercase
  • Mac names are a list, so unlisted ones aren't re-cased

What expensive mistakes does Name Input stop?

Names saved in caps or swapped

Also known as

name · full name · first name · last name · signup · profile · title case · customer name

Field type

What dependencies does Name Input require?

Name Input facts & technical specifications

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

What form validation mistake does Name Input catch?

Name Input prevents names saved in caps or swapped. Spots caps lock, all-lowercase, stray digits and swapped first/last names, and offers (never forces) a correctly cased fix. Catches: ALL CAPS or all-lowercase names, Digits and doubled spaces, First and last names swapped (from common-name lists), A full name typed into one box: offers to split, Re-casing that respects Mc/Mac, O', particles and hyphens. Limitation: validate name-input schemas on backend.

How do I install name-input with shadcn?

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

What props customize Name Input?

Name Input accepts `label`, `value`, `defaultValue`, `onValueChange`, `hint`. Configures name, full name, first name behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of name-input?

Casing and swap lists are English/Western-centric; they can be wrong for other naming traditions. Only suggests; some people really write their name in capitals or lowercase. Mac names are a list, so unlisted ones aren't re-cased Server requirement: backend verification for name-input.

How does Name Input meet accessibility guidelines?

Visible label; input is described by a polite hint region. Warnings appear after a pause while typing. Keep button has an aria-label and title; icons are aria-hidden. Minimizes errors: name all caps, first last name swapped.

Which components pair with Name Input?