Getting started
Install
Pick the package for your framework — each depends on @anil-labs/google-places-autocomplete-core automatically, so you don't install it separately.
sh
npm install @anil-labs/google-places-autocomplete-vuesh
npm install @anil-labs/google-places-autocomplete-reactsh
npm install @anil-labs/google-places-autocomplete-sveltesh
npm install @anil-labs/google-places-autocomplete-solidsh
npm install @anil-labs/google-places-autocomplete-elementThen see the framework guide for your framework for a complete usage example.
Google Cloud setup
- In Google Cloud Console, enable Places API (New) on your project (this is a separate toggle from the legacy "Places API").
- Create an API key and restrict it — for browser usage, an HTTP referrer restriction limiting it to your site's domain(s) is the standard practice (the same approach used for Maps JavaScript API keys).
- Pass that key as
apiKeyto whichever component/hook you're using.
If you'd rather not expose a key to the browser at all, every wrapper accepts a fetcher override — see Session tokens & billing for how to proxy requests through your own backend instead.
What you get back
Every wrapper resolves the same PlaceDetails shape on selection, regardless of framework:
ts
interface PlaceDetails {
placeId: string
displayName: string
formattedAddress: string
location: { lat: number; lng: number } | null
addressComponents: AddressComponent[]
}This is fetched automatically after a user picks a suggestion — you don't make a second API call yourself. See Session tokens & billing for exactly how that works and why it matters for cost.