Skip to content
WingoUI
ComponentsTemplatesDocsPricingAI agentsBlogChangelogContact
Components
Buttons & Actions
ButtonButton GroupCopy ButtonDelete ButtonTheme ToggleToggleToggle Group
Inputs
Avatar UploadCalendarCheckboxColor PickerComboboxCountry SelectCron PickerCurrency InputDate PickerDate Range PickerDate Time PickerDuration PickerEmail InputEmoji PickerFile UploadFilter BuilderInputInput GroupListboxMasked InputMention InputMonth PickerMulti SelectNumber InputOTP InputPassword InputPhone InputRadio GroupRatingSearch InputSegmented ControlSelectSignature PadSliderSwitchTag InputTextareaTime PickerTimezone SelectTree Select
Forms
Address InputBooking WidgetCSV ImportFieldForm WizardInline EditInvoice line itemsRich Text EditorSchema Builder
Navigation
Back To TopBounce SidebarBreadcrumbCommand MenuGlobal SearchGooey NavHook SidebarNav MenuNav TabsPaginationProximity SidebarScroll ProgressSidebarStepsTable Of ContentsTabsTopbarUser MenuWorkspace Switcher
Overlays
Alert DialogContext MenuDialogDrawerDropdown MenuFamily DrawerHover CardPopoverShare DialogSheetShortcuts DialogTooltipTour
Feedback
AlertBannerCookie ConsentEmoji ReactionEmpty StateNotification BellNotification CenterProgressRoute ProgressSetup ChecklistSkeletonSpinnerToast
Data Display
Approval FlowAvatarBadgeCalendar ViewCode BlockComment ThreadContact cardCountdownDescription ListDiff ViewerFile ListFile managerFolderGanttJSON ViewerKbdLog ViewerMarkdownPresenceSchedulerTagTimelineTree View
Tables & Lists
Audit LogData TableDeal PipelineEditable GridKanbanListMembers tablePermissions MatrixTableTask ListVirtual List
Charts & Stats
Animated CounterArea chartBar chartDonut chartFunnel chartGaugeGitHub ActivityHeatmap calendarLeaderboardLine chartRadar chartRadial barSparklineStat CardTrackerTrend badge
Layout
AccordionApp ShellCardCollapsibleDetail LayoutEntity HeaderPage HeaderScroll AreaSeparatorSettings LayoutSplit ViewToolbar
Media
Audio PlayerCarouselCSV ViewerDOCX EditorDOCX ViewerExcel ViewerFile SystemImage compareImage CropperImage GalleryImage LightboxLocation MapPDF ViewerPowerPoint ViewerQR CodeStep PlayerVideo Player
AI Kit
Agent Status CardChat MessageChat ThreadChat WidgetConversation ListFluid OrbGrid RevealMatrix OrbModel PickerPrompt InputReasoning IndicatorRule BuilderSuggestion ChipsTool Call TimelineUsage MeterVoice InputWorkflow Canvas
Text & Effects
Background PatternGravity LettersMarqueeTerminalText AnimateText Rotate
Mobile
Action SheetBottom Tab BarFABHaptic ButtonHero HeaderInstall PromptLarge Title HeaderNotification BannerOnboarding CarouselPicker WheelPull To RefreshSlide To ConfirmSticky CTA BarSwipe DeckSwipeable Tabs
Commerce
Cart drawerCategory pickerCheckout stepsCoupon inputFavorite buttonFilter panelListing cardListing gridOrder trackerPricePrice rangePricing tableProduct galleryQuantity stepperReviewsSeller card
Marketing Sections
App Download SectionBlog Cards SectionCTA SectionFAQ SectionFeature GridFeature ShowcaseHero SectionIntegrations SectionLogo CloudMarketing FooterMarketing HeaderMarketing SectionNewsletter SectionPricing SectionStats SectionSteps SectionTeam SectionTestimonials SectionTimeline SectionVideo Section
Blocks
Admin Dashboard PageAdmin ShellAI Chat PageAPI Keys PageAutomation Builder PageCheckout PageCRM Contact PageCRM Pipeline PageError PagesInbox PageInvoice PageKPI DashboardListing Detail PageLogin PageMarketplace Home PageMarketplace Search PageMarketplace ShellMobile App HomeOnboarding FlowOrder History PagePost Listing WizardPricing PageProfile PageRegister PageSettings PageUsers Admin Page
Templates
About PageAcademy PageAccessibility PageAffiliate PageAgency PageAI Product PageAppointment Booking PageBlog PageBlog Post PageBug Bounty PageCareers PageChangelog PageCommunity PageCompare PageContact PageCustomer Story PageCustomers PageDemo Booking PageDevelopers PageDocs Home PageDownload PageEnterprise PageEvents PageExperts PageFAQ PageFeature PageGlossary PageHelp Article PageHelp Center PageHome Services PageImpact PageIntegration Detail PageIntegrations PageJob Detail PageLanding PageLaunch PageLegal PageManifesto PagePortfolio PagePress PageProduct Tour PagePromo PageReal Estate PageReferral PageResearch Report PageRestaurant PageRoadmap PageROI Calculator PageSecurity PageSolutions PageStartups PageStatus PageStorefront PageSwitch PageTemplate Gallery PageTravel PageWaitlist PageYear in Review Page
Hooks & Utilities
AI ChatChart kitCommerceDate utilsFile exportFile typesFiltersForm validationHapticsInvoicingMotion presetsNavigationNumber formatRelative timeRomanian locationsSpreadsheetText matchTonesUIProvideruseClipboarduseConsentuseControllableStateuseCooldownuseDebounceuseKeyboardInsetuseLocaleuseLongPressuseMediaControlsuseMediaQueryuseOverflowItemsusePersistedStateuseScrollEdgesuseScrollStateuseSelectionuseShortcutuseStickToBottom
GalleryTheme

Hooks & Utilities

Romanian locations

Hooks & Utilities

Romanian locations TypeScript helper for React

Relative timeSpreadsheet
Live props
Options
radius30km
center
limit8
locale
  1. Home
  2. Components
  3. Hooks & Utilities
  4. Romanian locations
Pro

Romanian locations TypeScript helper for React

v1.0.0·Added in 1.0.0

Romania's counties, cities and neighbourhoods with coordinates, diacritic-free search, distances and within-radius lists.

Type a place without diacritics ("iasi", "manastur", "sector 3"): cities, neighbourhoods and counties match with the typed part highlighted, larger places first. Tap a result to make it the centre, then drag the radius in the playground: the list below shows every city within that distance, nearest first, in km for the chosen locale.

Romanian locations is a Pro React helper in the React hooks and utilities category, written in TypeScript for React 19. It installs as source with npx wingo-ui@latest add ro-locations, together with Text match and Number format.

Add to a project

Requirements: React 19, in Next.js (App Router or Pages), Vite or React Router. Installation guide · Next.js setup · Vite setup

npx wingo-ui@latest add ro-locations

Romanian locations is part of Pro, with 298 more Pro items: $8 a month or $150 once. 14-day refund before you download any Pro item. See plans

Usage

Import searchLocations from @/lib/ro-locations.

import { citiesWithin, cityOptions, formatDistance, searchLocations } from "@/lib/ro-locations"

searchLocations("manastur")[0] // { type: "area", label: "Mănăștur", description: "Cluj-Napoca, Cluj", ... }
cityOptions("CJ").map((o) => o.label) // ["Cluj-Napoca", "Florești", "Turda"]

citiesWithin("cluj-napoca", 30).map(({ city, distance }) => `${city.name} · ${formatDistance(distance, "en-US")}`)
// ["Cluj-Napoca · 0 m", "Florești · 10 km", "Turda · 26 km"]

API

  • radiusdefault 30
    number

    The demo's citiesWithin(center, radiusKm) radius in km. The centre city itself is always first, at 0 km.

  • centerdefault "cluj-napoca"
    string

    The demo's centre: a city id from RO_CITIES (citiesWithin also takes any { lat, lng }).

  • limitdefault 8
    number

    searchLocations options.limit: at most this many matches.

  • localedefault "en-US"
    string

    formatDistance's locale: "4.2 km" in en-US, "4,2 km" in ro-RO. The demo also prints the straight-line distance to a second city with one decimal.

  • searchLocations
    (query: string, options?: { limit?: number; types?: ("city" | "area" | "county")[]; county?: string }) => LocationMatch[]

    Cities, areas and counties matching a query, ignoring case and diacritics (through text-match), best match first and larger places first among equals, with ranges to highlight. An empty query returns the largest cities (the "popular" suggestions of a location field).

Parts

  • RO_COUNTIES

    constant

    The 41 counties and Bucharest, alphabetical, with the plate code ("CJ", "B") and the seat ("Cluj-Napoca"). Type: readonly { code: string; name: string; seat: string }[].

  • RO_CITIES

    constant

    Every county seat and the large towns (52), largest first, with the city-centre coordinates, residents in thousands (2021 census, rounded, for ordering only) and the neighbourhoods or sectors people put in listings. Type: readonly { id: string; name: string; county: string; lat: number; lng: number; population: number; areas?: string[] }[].

  • getCounty

    function

    Lookups by plate code (case-insensitive) and by city id (a slug: "targu-mures"). Signature: (code: string) => RoCounty | undefined.

  • getCity

    function

    Lookups by plate code (case-insensitive) and by city id (a slug: "targu-mures"). Signature: (id: string) => RoCity | undefined.

  • citiesInCounty

    function

    Lookups by plate code (case-insensitive) and by city id (a slug: "targu-mures"). Signature: (code: string) => RoCity[].

  • countyOptions

    function

    Options for select, combobox and listbox: { value: "CJ", label: "Cluj", description: "Cluj-Napoca", keywords } and { value: "cluj-napoca", label: "Cluj-Napoca", description: "Cluj", keywords: its areas }, so "manastur" finds Cluj-Napoca in a combobox. Signature: () => LocationOption[].

  • cityOptions

    function

    Options for select, combobox and listbox: { value: "CJ", label: "Cluj", description: "Cluj-Napoca", keywords } and { value: "cluj-napoca", label: "Cluj-Napoca", description: "Cluj", keywords: its areas }, so "manastur" finds Cluj-Napoca in a combobox. Signature: (county?: string) => LocationOption[].

  • distanceKm

    function

    Great-circle distance (Cluj-Napoca to Florești ≈ 10 km), the cities inside a radius nearest first (a "+25 km" location filter), and "850 m" / "4.2 km" / "37 km". Signature: (a: GeoPoint, b: GeoPoint) => number.

  • citiesWithin

    function

    Great-circle distance (Cluj-Napoca to Florești ≈ 10 km), the cities inside a radius nearest first (a "+25 km" location filter), and "850 m" / "4.2 km" / "37 km". Signature: (center: GeoPoint | string, radiusKm: number) => { city; distance }[].

  • formatDistance

    function

    Great-circle distance (Cluj-Napoca to Florești ≈ 10 km), the cities inside a radius nearest first (a "+25 km" location filter), and "850 m" / "4.2 km" / "37 km". Signature: (km: number, locale?: string) => string.

Examples

County and city selects

countyOptions and cityOptions feed two dependent selects for a Romanian shipping address.

Delivery radius

citiesWithin lists the cities inside a radius of a warehouse, nearest first, with formatDistance for the labels.

Dependencies

text-matchnumber-format

Files

  • lib/ro-locations.ts

FAQ

Is the Romanian locations helper free?

The preview, props and docs are free; copying the source needs a Pro plan. See plans.

How do I install Romanian locations?

Run npx wingo-ui@latest add ro-locations. It also adds the Wingo UI items it builds on (Text match and Number format). With shadcn, add the @wingo-ui registry with your API key, then run npx shadcn@latest add @wingo-ui/ro-locations.

See also

Text matchlibComboboxSelect

Used in

Onboarding FlowMarketplace Home PageLocation MapAddress InputCheckout PageListing Detail PageMarketplace Search PageMarketplace ShellPost Listing Wizard

More React hooks and utilities

SpreadsheetlibToneslibUIProviderlibuseClipboardhookuseConsenthookuseControllableStatehook
All 36 React hooks and utilities

Articles using this component

  • Romanian Address Format: The Rules and a React Form

    Build it: screens and apps · Oct 9, 2026 · 10 min read

PreviousRelative timeNext Spreadsheet
Cluj-Napoca + 30 kmCluj County · 3 places
  • Cluj-Napoca0 m
  • Florești10 km
  • Turda26 km

Straight-line distance to București: 324.2 km

searchLocations("", { limit: 8 }) · citiesWithin("cluj-napoca", 30)