Svelte Maplibre

API / Map

ZoomRange

Set minzoom and maxzoom for all components inside the slot. By default this only propagates the value to the inner layers.

You can set enforce to true to tear down the slot contents when the zoom is outside the range. This is usually bad for performance, so it is not recommended for use with map layers, but can have other uses such as creating and removing map controls or other behaviors depending on zoom level.

import { ZoomRange } from 'svelte-maplibre';

Examples

Props

  • minzoom number
  • maxzoom number
  • enforce boolean

    Default: false

    If true, only instantiate the slot contents when the map zoom is in range. If false, the layers themselves will handle it. Usually you will want this to be false.

  • children Snippet

Source: src/lib/ZoomRange.svelte