Patterns

Government ID Input

Filipino government and financial services all ship their own ID picker: usually the 2 to 3 most common types, with unreliable validation and generic error copy. This pattern standardizes the list and the inline behavior.

Live example

Six types shown for demo brevity. The full list ships in the package.

No ID selected yet.

npx shadcn@latest add @pilipinas/government-id-input

What it ships

  • A UMID, Passport, Driver's License, PhilHealth, SSS, GSIS, PRC, Postal, PhilSys registry with per-type format, placeholder, example, issuing authority and pattern regex.
  • Type select is an inline Select; the number field is a normal Input. Both carry Field-style wiring for label, description and error text.
  • Format example is inline next to the placeholder (not in a tooltip) because hovering requires a pointer.
  • Bilingual error copy via lang="fil" (default) and lang="en".
  • Consumer-injected type list: pass your own types prop to add Senior Citizen, PWD, Voter's ID or anything else your service actually accepts.

Validation caveat

Type patterns are formats, not authenticity checks; SSS numbers can be valid-shaped but issued to someone else. If you verify with an API, do it after this input, on submit.

Why this is here

Philippine services need government ID numbers on almost every form. Every team writes it from scratch: three types at best, error copy that says "invalid input", validation blind to format differences between UMID and GSIS. By standardizing the registry and the inline hints, the pattern pays for itself the first time a barangay clerk on a 400-nit display has to tell a farmer which ID number is required.

Other patterns: Patterns index. If you are building a service and need a new ID type, open an issue with the admission sentence: which services, which issuer, which format.