Skip to content

BaseMap Control

Usecase

  • Allow end users to switch base layers (streets/satellite/dark) quickly.
  • Preconfigure a curated list of base maps for consistency across apps.

Props

PropDescriptionTypeRequiredDefault Value
mapIdstringfalse--
dragIdstringfalse--
btnWidthnumberfalse40
position'top-left', 'top-right', 'bottom-left', 'bottom-right'false'bottom-right'
controlVisiblebooleanfalsetrue

and

PropDescriptionTypeRequiredDefault Value
titlestringfasle``
defaultBaseMapstringfasleOpen Street Map
controlIconstringfasle``
baseMapsBaseMapItem[]arrayfasle``

Slots

NameDescription
defaultid:string

Events

EventPayloadDescription
basemap-changeBasemapFired when basemap changes

Usage

Vue

vue
<script setup lang="ts">
import { Map } from '@hungpvq/vue-map-core';
import { BaseMapControl } from '@hungpvq/vue-map-core';
import '@hungpvq/vue-map-core/style.css';
const baseMaps = [];
</script>

<template>
  <Map>
    <BaseMapControl :baseMaps="baseMaps" />
  </Map>
</template>

React

tsx
import { Map, BaseMapControl } from '@hungpvq/react-map-core';
import '@hungpvq/react-map-core/style.css';

const baseMaps = [];

<Map>
  <BaseMapControl baseMaps={baseMaps} />
</Map>