[](https://www.npmjs.com/package/@googlemaps/markerwithlabel)  ](https://www.npmjs...
Read more[](https://www.npmjs...
Read more[](https://www.npmjs...
Read moreCore dependencies of this npm package and its dev dependencies.
@babel/preset-env, @babel/runtime-corejs3, @googlemaps/jest-mocks, @rollup/plugin-babel, @rollup/plugin-commonjs, @rollup/plugin-typescript, @types/google.maps, @types/jest, @types/selenium-webdriver, @typescript-eslint/eslint-plugin, @typescript-eslint/parser, chromedriver, core-js, eslint, eslint-config-prettier, eslint-plugin-jest, eslint-plugin-prettier, geckodriver, jest, prettier, rollup, rollup-plugin-terser, selenium-webdriver, ts-jest, typedoc, typescript
A README file for the @googlemaps/markerwithlabel code repository. View Code
The library provides Markers with labels for Google Maps Platform.
Note: This library is the nearly the same interface as the existing library
@google/markerwithlabel
, but renamed and in its own repository. All future development will continue here.
Note: There are some breaking changes from
@google/markerwithlabel
including anchor position. This should be considered a major version bump!
Available via npm as the package @googlemaps/markerwithlabel.
npm i @googlemaps/markerwithlabel
or
yarn add @googlemaps/markerwithlabel
Alternatively you may add the umd package directly to the html document using the unpkg link.
<script src="https://unpkg.com/@googlemaps/markerwithlabel/dist/index.min.js"></script>
When adding via unpkg, the marker with labels can be accessed at new markerWithLabel.MarkerWithLabel()
.
A version can be specified by using https://unpkg.com/@googlemaps/markerwithlabel@VERSION/dist/...
.
The reference documentation can be found at this link.
import { MarkerWithLabel } from '@googlemaps/markerwithlabel';
new MarkerWithLabel({
position: new google.maps.LatLng(49.475, -123.84),
clickable: true,
draggable: true,
map: map,
labelContent: "foo", // can also be HTMLElement
labelAnchor: new google.maps.Point(-21, 3),
labelClass: "labels", // the CSS class for the label
labelStyle: { opacity: 1.0 },
})
View the package in action: