A declarative Svelte component library for the Google Maps JavaScript API.
- Documentation: https://skyt-a.github.io/svelte-google-maps-api/
- Storybook: https://skyt-a.github.io/svelte-google-maps-api/storybook/
- npm: https://www.npmjs.com/package/svelte-google-maps-api
pnpm add svelte-google-maps-apinpm install svelte-google-maps-apiyarn add svelte-google-maps-api<script lang="ts">
import { APIProvider, GoogleMap, Marker } from 'svelte-google-maps-api';
const apiKey = 'YOUR_MAP_KEY';
</script>
<div style="width: 100%; height: 100vh;">
<APIProvider {apiKey}>
<GoogleMap
options={{
center: { lat: 35.6812362, lng: 139.7649361 },
zoom: 14
}}
mapContainerStyle="width:100%;height:100%;"
>
<Marker position={{ lat: 35.6812362, lng: 139.7649361 }} />
</GoogleMap>
</APIProvider>
</div>Some components require optional Google Maps libraries:
| Component | Required library |
|---|---|
AdvancedMarker |
marker |
Autocomplete, StandaloneSearchBox |
places |
DrawingManager |
drawing |
HeatmapLayer |
visualization |
<APIProvider {apiKey} libraries={['marker', 'places', 'drawing', 'visualization']}>
<!-- map components -->
</APIProvider>The package includes map, marker, clusterer, info window, shape, layer, places, directions, distance matrix, custom control, custom overlay, data layer, and Street View components. See the docs for full props and examples.
corepack pnpm install
corepack pnpm test
corepack pnpm check
corepack pnpm lint
corepack pnpm buildDocs and Storybook stay synchronized with the package exports:
corepack pnpm docs:sync:checkSee CONTRIBUTING.md.
See SECURITY.md.
MIT