Game Map
A world map and a HUD minimap that share one set of data, laid out like a maps app: small pins whose labels make room for each other, numbered clusters when zoomed out, a place panel (side panel on wide maps, bottom sheet on phones), filter chips, search, "find me", zoom and a scale bar. Regions can sit under clouds until discovered. Everything is in your game's own units, so markers come straight from game state.
Click a pin to open its place panel with your own buttons (Travel moves the player). Labels that would overlap hide and show on hover; pins close together become a numbered cluster. Right-click or long-press drops a waypoint; Explore lifts the clouds off a region.
Installation
Usage
Examples
MiniMap
The minimap follows the player. Tracked places out of range show as arrows on the rim. rotate turns the map so the player faces up; click a minimap to open the full map.
API
Everything else is passed through to the underlying element or Radix primitive.
| Prop | Type | Default | Description |
|---|---|---|---|
mapWidth / mapHeight | number | – | Map size in your units. x runs 0..mapWidth to the right, y 0..mapHeight down. |
background | ReactNode | string | – | An image URL, or an SVG, canvas or tile grid drawn at mapWidth × mapHeight. |
markers | MapMarker<T>[] | – | { id, x, y, label, kind?, icon?, color?, subtitle?, description?, image?, priority?, tracked?, alert?, hidden?, data? }. Higher priority wins label space. Markers inside regions under clouds are hidden. |
regions | MapRegion[] | – | { id, name, points, color?, discovered?, labelAt? }. `discovered: false` covers the region with clouds. |
paths / player / waypoint / kinds | MapPath[] / MapPlayer / [x, y] / Record<string, MapKind> | – | Routes { points, color?, dashed?, width? }, the player { x, y, heading?, icon?, label? }, a waypoint flag, and marker kinds { label, icon?, color? } for the filter chips. |
GameMap: height | number | string | 460 | Box height; width fills the container. |
GameMap: view / defaultView / onViewChange | { x, y, zoom } | player, fill | Control the centre and zoom. Zoom 1 = one map unit per px. |
GameMap: minZoom / maxZoom / labelZoom / focusZoom | number | fill / 4 / always / 1.8×fill | Zoom limits (by default the map just fills the box), when labels appear, and the zoom used when flying to a place. |
GameMap: selectedId / onMarkerSelect | string | null / (marker | null) => void | – | The open place. The map moves so it is never under the panel; Escape, the close button, a click on the map or pulling the sheet down closes it. |
GameMap: renderMarker / renderDetails / markerActions | fn | – | Your own pin, place panel body, or buttons in the default panel. |
GameMap: cluster | number | 34 | Pins closer than this many px merge into a numbered bubble; clicking it zooms in. 0 turns it off. |
GameMap: onWaypointChange | (point | null) => void | – | Right-click or long-press on the map gives you a point to store as `waypoint`. |
GameMap: scale | { perUnit, unit } | – | Scale bar: one map unit is perUnit of unit, e.g. { perUnit: 0.5, unit: "m" }. |
GameMap: search / legend / controls / followPlayer | boolean | false / true / true / false | Place search, filter chips, zoom and find-me buttons, and keeping the player centred. |
GameMap: hiddenKinds / onHiddenKindsChange | string[] | [] | Control the legend filter. |
MiniMap: size / shape | number / "circle" | "square" | 168 / "circle" | Box size in px and shape. |
MiniMap: zoom / defaultZoom / onZoomChange | number | 1 | Zoom level, with + and − buttons (zoomControls). |
MiniMap: rotate / compass / showRegion | boolean | false / true / true | Heading-up map, the north marker, and the name of the region you are in. |
MiniMap: center / onOpen / children | [x, y] / () => void / ReactNode | player | Centre (defaults to the player), click to open the full map, and overlays like a clock. |
regionAt / useRegionChange | function / hook | – | The region that contains a point, and a hook that calls you when the player moves into another region (e.g. to show "Entering the Rice paddies"). |