map

A map is a zoomable, pinned image placed inside a diagram — built for game-guide and reference maps. A diagram holding a map is automatically interactive (wheel to zoom, drag to pan, + / / controls) and loads the bundled map player; you don't need pan_zoom = true. source is the map image; width / height set its coordinate space.

PropertyTypeRequiredDescription
nameidentifiernoOptional reference name (the inline label).
sourceutf8noSingle whole-map image (the common, layer-less case).
widthf64yesMap coordinate-space width — also the pin coordinate space.
heightf64yesMap coordinate-space height — also the pin coordinate space.
tile_sizei64noTile pixel size for tiled layers (default 256).
smoothboolnoimage-rendering: smooth (default) vs pixelated when false.
classlist<utf8>noThemes the map group.
ididentifiernoOptional explicit HTML id.
xf64noPlacement x within the enclosing diagram / container.
yf64noPlacement y within the enclosing diagram / container.
anchor_leftf64noDiagram anchor insets (left/right/top/bottom), like any SvgBlock.
connect_pointslist<AnchorSide>noDiagram edge-attach sides, like any SvgBlock.

Child blocks

SlotAcceptsMultipleDescription
layerslayeryesLevel-of-detail image layers (omit for a single source).
pinspinyesClickable markers with cards.

§ 1Pins and cards

Each pin is an icon dropped at x / y in the map's coordinate space (its id is the inline label, unique on the page). Style the marker with a class (themable, supports dark / light) or the one-off color. A pin's child blocks become a floating card anchored to the marker: text, lists, callouts, code, images all compose in.

A pin dropped at x / y in the map's coordinate space; its child blocks become a floating card anchored to the marker.

PropertyTypeRequiredDescription
ididentifieryesPin id (the inline label) — links the pin to its card; page-unique.
xf64yesMarker x position, in the map's coordinate space.
yf64yesMarker y position, in the map's coordinate space.
iconutf8noIcon name (default lucide.map-pin); set.name or pair with set.
setidentifiernoIconset name for a bare icon.
sizef64noMarker size in map units (default 24).
classlist<utf8>noThemes the marker (fill / stroke / color, with dark / light).
card_classlist<utf8>noThemes the card popup (background / color / border).
colorutf8noOne-off inline marker colour (sugar for a class).
titleutf8noOptional card heading.

Child blocks

SlotAcceptsMultipleDescription
cardWdocBlockyesThe card body — any wdoc blocks.

Live below — scroll to zoom, drag to pan, then click a marker to open its card. (A map is an interactive viewport, so it renders directly at full width rather than in a light/dark demo, and the diagram is automatically interactive — no pan_zoom needed.)

wcl
diagram { width = 640  height = 320  zoom_max = 8.0
  map "earth" {
    source = "assets/blue-marble.png"
    width  = 1280  height = 640
    pin "newyork" {
      x = 377  y = 175
      icon  = "lucide.building-2"  color = "#fbbf24"  title = "New York"
      text { span "Financial capital on the US east coast." {} }
      callout "Tip" { class = ["tip"]  body = "Cards accept any wdoc content." }
    }
  }
}

§ 2Level-of-detail layers

Omit layers and the map's source is the only image. For large maps, supply several layers and the player shows the sharpest layer that suits the current zoom. A layer is one image when cols / rows are 1, or a grid of tiles otherwise — source is then a folder and each tile's filename comes from pattern (default {x}_{y}.png, 0-based).

A level-of-detail image (or grid of tiles) the map player swaps in at the zoom range it best suits.

PropertyTypeRequiredDescription
sourceutf8yesImage file, or the tile folder when tiled.
colsi64noTiles across (default 1 = a single image).
rowsi64noTiles down (default 1).
patternutf8noTile filename pattern (default {x}_{y}.png, 0-based).
tile_sizei64noOverride the map's tile_size for this layer.

Maps ride the class system: a pin's class themes its marker, card_class themes its popup, and the built-in look reads the theme variables, so a site theme styles maps for free. See styling.