DOB Input

DOB Input is a copy-paste React component that stops birth year typed as this year 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/dob-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

StopsBirth year typed as this year

Was this component page useful?

How do I install DOB Input?

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

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

How do I use DOB Input in React?

dob-input-usage.tsx
import { DobInput } from "@/components/ui/dob-input"

<DobInput label="Your date of birth" hint="For example, 27 3 1990" defaultValue="2026-03-14" today="2026-10-13" />

What input mistakes does DOB Input catch?

  • This year typed as the birth year (age 0)
  • Future dates and implausible ages (minAge, maxAge)
  • A day typed into the month box
  • Pasted dates that could be read two ways
  • Under-age sign-ups, with the date the person becomes eligible

What props does DOB Input accept?

DobInput props
PropTypeDefault
label

Legend for the group.

string"Date of birth"
hint

Hint under the legend, e.g. "For example, 27 3 1990".

string—
value

Controlled value as `YYYY-MM-DD`, or `""` while incomplete.

string—
defaultValue

Initial value when uncontrolled.

string""
onValueChange

Called with `YYYY-MM-DD` once the parts make a real past date, else `""`, plus the age.

(value: string, age?: number) => void—
order

Order of the boxes.

"dmy" | "mdy" | "ymd""dmy"
minAge

Block anyone younger than this, with the date they become old enough.

number—
maxAge

Ages above this are flagged as a likely year typo.

number120
allowInfants

Allow babies born this year (e.g. a child's record) without a warning.

booleanfalse
today

"Today" as `YYYY-MM-DD`. Defaults to the user's local date once mounted.

string—
locale

Locale for month names and dates.

string"en-IN"
partLabels

Box labels.

Record<Part, string>{ day: "Day", month: "Month", year: "Year" }
messages

Override any message.

Partial<DobMessages>—

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

How is DOB Input accessible?

  • Day, month and year each have a <label>, and are described by a shared status
  • aria-invalid on errors; Backspace in an empty part moves to the previous part
  • Focus moves between parts as each one is completed

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: Re-check age eligibility on the server; a client-side date check can be bypassed.

  • Plausibility checks only; it can't verify a real birth date
  • Field order follows the `order` prop or locale; check it matches your users

What expensive mistakes does DOB Input stop?

Birth year typed as this year

Also known as

date of birth · dob · birthday · age verification · dd/mm/yyyy · kyc · pan · 18+

Field type

What dependencies does DOB Input require?

DOB Input facts & technical specifications

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

How does DOB Input validate Indian financial identifiers?

DOB Input stops birth year typed as this year. Complies with national standards for This year typed as the birth year (age 0), Future dates and implausible ages (minAge, maxAge), A day typed into the month box, Pasted dates that could be read two ways, Under-age sign-ups, with the date the person becomes eligible. Limitation: verify dob-input with issuer gateway.

How do I install dob-input with shadcn?

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

What props customize DOB Input?

DOB Input accepts `label`, `hint`, `value`, `defaultValue`, `onValueChange`. Configures date of birth, dob, birthday behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of dob-input?

Plausibility checks only; it can't verify a real birth date. Field order follows the `order` prop or locale; check it matches your users Server requirement: Re-check age eligibility on the server; a client-side date check can be bypassed.

How does DOB Input meet accessibility guidelines?

Day, month and year each have a <label>, and are described by a shared status. aria-invalid on errors; Backspace in an empty part moves to the previous part. Focus moves between parts as each one is completed. Minimizes errors: wrong date of birth, dob shows age 0.

Which components pair with DOB Input?