Skip to content

Components

The vue3-openlayers-styled-controls library provides a set of customizable map controls that can enhance your OpenLayers maps with beautiful, responsive UI components.

Available Controls

ComponentDescription
ol-styled-control-barContainer component for organizing other controls
ol-styled-home-controlHome
ol-styled-zoom-in-controlZoom in
ol-styled-zoom-out-controlzoom out
ol-styled-full-screen-controlToggle full screen mode
ol-styled-measure-length-controlMeasure distances
ol-styled-measure-area-controlMeasure areas
ol-styled-text-label-controlAdd text labels to the map
ol-styled-plot-controlPlot
ol-styled-export-map-controlExport
ol-styled-clear-controlClear drawings and measurements from the map
ol-styled-swipe-controlEnable layer swiping functionality
ol-styled-base-layer-switcherSwitch between different base map layers

Usage

All components can be used in two ways:

When you install the plugin, all components are automatically registered globally:

js
import { createApp } from 'vue'
import App from './App.vue'
import OpenLayersControls from 'vue3-openlayers-styled-controls'

const app = createApp(App)
app.use(OpenLayersControls)
app.mount('#app')

Then use the components with the ol-styled- prefix:

vue
<template>
  <ol-styled-control-bar>
    <ol-styled-zoom-in-control />
    <ol-styled-zoom-out-control />
    <ol-styled-full-screen-control />
  </ol-styled-control-bar>
</template>

2. Individual Import

You can also import components individually to reduce bundle size:

vue
<template>
  <ControlBar>
    <ZoomInControl />
    <ZoomOutControl />
    <FullScreenControl />
  </ControlBar>
</template>

<script setup>
import { 
  ControlBar, 
  ZoomInControl, 
  ZoomOutControl, 
  FullScreenControl 
} from 'vue3-openlayers-styled-controls'
</script>

Common Props

Most controls share some common props:

PropTypeDefaultDescription
mapMapundefinedOpenLayers Map instance (usually injected automatically)
classNamestring''Additional CSS class names
disabledbooleanfalseDisable the control

Styling

All controls support theming through SCSS variables. See the theming guide for more information on customizing the appearance.

Released under the MIT License.