Patterns

Philippine Address & Location

A Philippine address is a PSGC decision wrapped in optional local detail. This pattern defines how the cascade, the free-form lines and the stored codes fit together across services.

Where this appears

Enrollment, permits, benefits, delivery and relief registration all ask for a location, but they do not all need the same depth. A national ID capture site needs the barangay. A delivery note may only need the city and a landmark. Deciding the required depth is part of the pattern, not an implementation detail left to each form.

Live example

Illustrative data only. Nothing below region is bundled; a real service injects a verified PSA export. The output keeps codes for storage and labels for reading.

Composing a full address

PSGC 3Q 2026 · demo
Address location

PSGC data as of 3Q 2026 (demonstration data)

Choose a region

Not all addresses have a street name. Leave it blank.

Useful for delivery and assisted navigation.

Output

Barangay

City / Municipality

Province

Region

region: —

province: —

city: —

barangay: —

Choose down to barangay to resolve the PSGC codes.

npx shadcn@latest add @pilipinas/location-selector

Anatomy

  • PSGC cascade. Region → province → city/municipality → barangay. Each step is a labeled combobox, and later steps appear only when their parent is chosen.
  • Local detail. Street, subdivision, sitio, building, unit and landmark are free-form and optional. They follow the cascade, never replace it.
  • Data currency. The export date is visible beside the cascade. Stale geography is a defect, not a tradeoff.
  • Output. Codes for storage and filtering; labels for confirmation and printing.

Decisions grounded in research

  • NCR is first, then regions alphabetically. Plain alphabetical order buries the largest population region under “N”.
  • Duplicate names are disambiguated with a level suffix; barangays are filtered by parent so the many Poblacions stay reachable.
  • Search-within-list replaces a raw <select> of tens of thousands of entries.
  • Filipino labels are the default. English is an opt-in lang, not a rewrite.
  • The component never invents rows below region; data comes from a verified quarterly PSA release.

Failure and recovery

A missing match is not an error to be silently swallowed. Keep the last valid parent intact, show the empty state with the plain-language label (“Walang barangay / No barangays found”), and let the person choose a different parent or continue with a marked incomplete address when the service allows it. On low-bandwidth or shared devices, save the resolved cascade after each step rather than at final submit; this follows the connectivity guidance in Filipino Digital Context and the recovery rules in States & Feedback.

Output contract

Emit the resolved PSGC codes as structured strings, the display labels separately, the optional free-form lines as entered, and the dataCurrency of the source export. Do not validate arbitrary street text beyond the cascade, and do not concatenate codes into a display address. Street-level verification belongs to the service that owns the address.

When to use and when not to

  • Use for any Philippine location where region through barangay is meaningful.
  • Do not force a barangay when the service genuinely operates at city level; stop the cascade where the decision ends.
  • Do not use this pattern for international addresses. Different hierarchies need a different pattern.
  • Do not turn the cascade into a stepper by default. A staged wizard is justified only when the flow itself has distinct stages.

Composition

Built from Combobox for each cascade step, Field for labels and descriptions, and the shared sizes from Layout & Spacing. Empty results use the vocabulary in States & Feedback. The component itself is documented in the Combobox related section and installed from the registry as @pilipinas/location-selector.

Research basis

Built from 04; Philippine Address Structure, which records the four levels, 10-digit PSGC codes, stale-data and duplicate-name failure modes, and the NCR ordering rule. The flow-level context is in 05; Service Flow UX, and the cascade appears in a real flow at Scholarship Application.

Other patterns: Patterns index. If a pattern you need is missing, that is a gap in this project; open an issue.