API / Controls
Control
Add a custom control to the map. The children of this component become the content of the control.
Put it inside the MapLibre component. By default the control has the maplibregl-ctrl class. Set defaultStyling to false to remove it. Use ControlGroup and ControlButton inside it to make buttons that look like the built-in MapLibre controls.
<Control position="top-left">
<ControlGroup>
<ControlButton onclick={doSomething}>A</ControlButton>
</ControlGroup>
</Control>import { Control } from 'svelte-maplibre'; Examples
Props
- defaultStyling
booleanDefault:
true - position
maplibregl.ControlPositionDefault:
'top-right' - class
string - children
Snippet
Source: src/lib/Control.svelte