Near-Duplicate Input

Near-Duplicate Input is a copy-paste React component that stops duplicate tags with different spelling 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/near-duplicate-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

StopsDuplicate tags with different spelling

Was this component page useful?

How do I install Near-Duplicate Input?

pnpm dlx shadcn@latest add @bollard/near-duplicate-input

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

How do I use Near-Duplicate Input in React?

near-duplicate-input-usage.tsx
import { NearDuplicateInput } from "@/components/ui/near-duplicate-input"

<NearDuplicateInput
  label="New tag"
  items={tags}
  defaultValue="marketing "
  onCreate={(name) => {
    setTags((current) => [...current, name])
    setPicked(name)
  }}
  onUseExisting={setPicked}
/>

What input mistakes does Near-Duplicate Input catch?

  • Same name in different capitals or spacing
  • Punctuation differences
  • Plural vs singular (Bugs vs bug)
  • One-letter typos and swapped letters
  • Leaves different numbers alone (Q3 vs Q4)

What props does Near-Duplicate Input accept?

NearDuplicateInput props
PropTypeDefault
items* (required)

Names that already exist.

readonly string[]—
label

Visible label.

string"New tag"
value

Controlled text.

string—
defaultValue

Initial text when uncontrolled.

string""
onValueChange

Called with the text on every change.

(value: string) => void—
onCreate* (required)

Creates the trimmed name. Return a promise to show a pending state; throw to keep the text.

(name: string) => void | Promise<void>—
onUseExisting

Called when the user picks the existing item instead.

(item: string) => void—
messages

Warning text per reason; `{item}` marks where the existing name goes.

Partial<Record<DuplicateReason, string>>—
createLabel

Label of the create button.

string"Create"
createAnywayLabel

Create button label while a near-duplicate (but not a same-name) match is showing.

string"Create anyway"
useExistingLabel

Label of the one-tap fix that picks the existing item.

string"Use existing"

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

How is Near-Duplicate Input accessible?

  • Visible label; input is described by a polite hint region
  • Enter picks the existing item when a near-duplicate is shown
  • Use existing button's aria-label names the item; create shows aria-busy while pending

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

What are the limitations and server boundaries?

  • Compares against the items you pass; it doesn't search your database
  • Synonyms (Sales vs Revenue) aren't detected
  • English plural rules only

What expensive mistakes does Near-Duplicate Input stop?

Duplicate tags with different spelling

Also known as

tags · labels · categories · create new · dedupe · folder name · tag input · taxonomy

Field type

What dependencies does Near-Duplicate Input require?

Near-Duplicate Input facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameNear-Duplicate Input
Registry identifier@bollard/near-duplicate-input
Install commandnpx shadcn@latest add @bollard/near-duplicate-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 Near-Duplicate Input

What form validation mistake does Near-Duplicate Input catch?

Near-Duplicate Input prevents duplicate tags with different spelling. Spots near-duplicates of existing names as you type, so a second "Marketing" tag or folder isn't created by accident. Catches: Same name in different capitals or spacing, Punctuation differences, Plural vs singular (Bugs vs bug), One-letter typos and swapped letters, Leaves different numbers alone (Q3 vs Q4). Limitation: validate near-duplicate-input schemas on backend.

How do I install near-duplicate-input with shadcn?

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

What props customize Near-Duplicate Input?

Near-Duplicate Input accepts `items`, `label`, `value`, `defaultValue`, `onValueChange`. Configures tags, labels, categories behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of near-duplicate-input?

Compares against the items you pass; it doesn't search your database. Synonyms (Sales vs Revenue) aren't detected. English plural rules only Server requirement: backend verification for near-duplicate-input.

How does Near-Duplicate Input meet accessibility guidelines?

Visible label; input is described by a polite hint region. Enter picks the existing item when a near-duplicate is shown. Use existing button's aria-label names the item; create shows aria-busy while pending. Minimizes errors: duplicate tags case, marketing vs marketings.

Which components pair with Near-Duplicate Input?