{"id":15578305,"url":"https://github.com/eregnier/vue-leaflet-custom-marker","last_synced_at":"2025-04-24T01:10:51.356Z","repository":{"id":136704775,"uuid":"423993262","full_name":"eregnier/vue-leaflet-custom-marker","owner":"eregnier","description":"vue leaflet for open street map custom marker component ","archived":false,"fork":false,"pushed_at":"2021-11-26T13:13:02.000Z","size":873,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-30T05:23:57.022Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Vue","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eregnier.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-11-02T20:43:41.000Z","updated_at":"2024-09-02T08:14:48.000Z","dependencies_parsed_at":"2024-01-02T23:30:04.685Z","dependency_job_id":"b18dd6f7-5a64-46a6-9d41-111fe851e934","html_url":"https://github.com/eregnier/vue-leaflet-custom-marker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eregnier%2Fvue-leaflet-custom-marker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eregnier%2Fvue-leaflet-custom-marker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eregnier%2Fvue-leaflet-custom-marker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eregnier%2Fvue-leaflet-custom-marker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eregnier","download_url":"https://codeload.github.com/eregnier/vue-leaflet-custom-marker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250540941,"owners_count":21447427,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T19:08:05.230Z","updated_at":"2025-04-24T01:10:51.334Z","avatar_url":"https://github.com/eregnier.png","language":"Vue","funding_links":["https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=UV5GR9QWPAEMS"],"categories":["Components \u0026 Libraries"],"sub_categories":["UI Components"],"readme":"# vue leaflet custom marker\n\n[\n![npm](https://img.shields.io/npm/v/vue-leaflet-custom-marker.svg)\n![npm](https://img.shields.io/npm/dm/vue-leaflet-custom-marker.svg)\n](https://www.npmjs.com/package/vue-leaflet-custom-marker)\n![vue2](https://img.shields.io/badge/vue-2.x-brightgreen.svg)\n\nThis component allows you to display custom HTML content on the map using Overlay.\nI made this component for leaflet because I made the one for [google map](https://github.com/eregnier/vue2-gmap-custom-marker) and it was quite easy for me to adapt and do this one then.\n\n[Demo](https://vue-leaflet-custom-marker-demo.pages.dev/)\n\nYou might look at this [demo code repository](https://github.com/eregnier/vue-leaflet-custom-marker-demo) for features usage and complete exemple around this plugin.\n\n## Features\n\n- Display reactive custom html into markers on google map using slot system\n\n- Live property change allows simple interaction with coordonates and zindex of html marker element\n\n- Simple positionning system for marker around the origin point\n\n- Specific markers offset X and Y for more control about html element display\n\n- Almost all API of the component is optional, just start with lon, lat property\n\n## Example\n\nhttps://user-images.githubusercontent.com/5399780/143586275-d25dfe7a-732b-4d09-b47f-b1a359574828.mp4\n\n## Installation\n\nInstall the package from [npm](https://www.npmjs.com/package/vue-leaflet-custom-marker):\n\n`npm i vue-leaflet-custom-marker`\n\n## Basic Usage\n\nImport the component and use it in the components object.\n\n```javascript\nimport CustomMarker from 'vue-leaflet-custom-marker';\n\nexport default = {\n  [...],\n  components: {\n      CustomMarker\n  },\n  [...]\n}\n```\n\nUse the custom marker inside the map component. Add HTML or other Vue components inside the custom marker to be rendered on the map.\n\n```vue\n\u003ctemplate\u003e\n\u003cl-map zoom=\"15\" :center=\"marker\"\u003e\n  \u003cl-tile-layer url=\"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\" attribution=\"http://osm.org/copyright\"\u003e\u003c/l-tile-layer\u003e\n  \u003ccustom-marker\n    :marker=\"marker\"\n    @click.native=\"someFunction\"\n  \u003e\n    \u003cdiv\n      style=\"width: 50px; height: 50px; border: 1px solid blue\"\n      :style=\"{ 'background-color': isBlue ? 'blue' : 'red' }\"\n    \u003e\n      \u003cbutton @click=\"toggle\"\u003eX\u003c/button\u003e\n    \u003c/div\u003e\n  \u003c/custom-marker\u003e\n\u003c/l-map\u003e\n\u003ctemplate\u003e\n\u003cscript\u003e\nexport default = {\n  //[...],\n  methods: {\n    toggle () {\n      this.isBlue = !this.isBlue\n    }\n  },\n  data() {\n    return {\n      isBlue: false,\n      marker: {\n        lat: 50.60229509638775,\n        lng: 3.0247059387528408\n      }\n    }\n  //[...]\n}\n\u003c/script\u003e\n```\nℹ️ Use the @click event with the .native modifier to bind a function to the clicking of the custom marker.\n\nSpecify the marker alignment with the `alignment` property. It accepts 13 values: `top`, `bottom`, `left`, `right`, `center`, `topleft`, `topright`, `bottomleft`, `bottomright`. Defines the alignment of the marker relative to the lat/lng specified, e.g. `bottomright` - the marker will be below and on the right of the location.\n\n```vue\n\u003ccustom-marker :marker=\"marker\" alignment=\"bottomright\"\u003e\n  \u003cp\u003econtent\u003c/p\u003e\n\u003c/custom-marker\u003e\n```\n\n\u003c!-- ![custom markers on vue leaflet map](alignment.png) --\u003e\n\nManually specify an offset value for the marker in pixels with prop `offsetX` | `offsetY`. A positive `offsetX` moves the marker further right, and a positive `offsetY` moves the marker further down the page. Can be used with the `alignment` prop.\n\n```vue\n\u003ccustom-marker :marker=\"marker\" :offsetX=\"-10\" :offsetY=\"17.5\"\u003e\n  \u003cp\u003econtent\u003c/p\u003e\n\u003c/custom-marker\u003e\n```\n\n## Reference\n\n|   **Prop**    | **Type** | **Default** |                                                                        **Description**                                                                        |                                                               **Supported Values**                                                                |\n| :-----------: | :------: | :---------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------: |\n|   `marker`    |  Object  |   `null`    |                                Provide the latitude and longitude values that the marker should be displayed at. **Required**                                 |                                 Provide an Object with `lat` and `lng` properties. `{ lat: Number, lng: Number }`                                 |\n|   `offsetX`   |  Number  |     `0`     |                          The number of pixels to move the marker by in the x-direction. Postive values move the marker to the right                           |                                                           Positive or negative number.                                                            |\n|   `offsetY`   |  Number  |     `0`     |                        The number of pixels to move the marker by in the y-direction. Postive values move the marker to down the page.                        |                                                           Positive or negative number.                                                            |\n|  `alignment`  |  String  |    `top`    | The alignment of the marker element relative to the location it is displayed. e.g. `bottomright` - the marker will be below and on the right of the location. | `top`, `bottom`, `left`, `right`, `center`, `topleft`, `topright`, `bottomleft`, `bottomright` |\n|   `zIndex`    |  Number  |    `50`     |                                                                    z-index of the marker.                                                                     |                                                                 Positive number.                                                                  |\n\n## Licence\n\n[MIT](https://en.wikipedia.org/wiki/MIT_License)\n\n## Support\n\nIf you want to support this plugin it is possible :smile: \n\n[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=UV5GR9QWPAEMS)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feregnier%2Fvue-leaflet-custom-marker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feregnier%2Fvue-leaflet-custom-marker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feregnier%2Fvue-leaflet-custom-marker/lists"}