A flexible, accessible, and secure Svelte component that brings the power of Google's address search to your application in minutes.
Try it out! This is the component in action with default settings.
Enable the Places API in the Google Cloud Console and create an API key. Learn how.
Import the component and add it to your page. See the Basic Usage guide for the full code.
<script>
import { PlaceAutocomplete } from 'places-autocomplete-svelte';
import type { PlaceResult } from 'places-autocomplete-svelte/interfaces';
// Get API Key securely (e.g., from environment variables)
const PUBLIC_GOOGLE_MAPS_API_KEY = import....Follows WAI-ARIA patterns with full keyboard navigation.
Safely renders suggestions to protect against XSS attacks.
Automatically handles session tokens to manage API costs.
Limits API calls while the user is typing to save requests.
Easily override styles or provide your own using props.
Fully written in TypeScript with included type definitions.
The core logic of this component is also available as a standalone JavaScript library, places-autocomplete-js. It provides the same robust features for any web application, regardless of the framework.