Builtin Library
README.md
minimap
Luau builder over canvas for a square minimap. Renders a 150×150
dark-green square with a single light-green centre marker by default,
and accepts an optional markers array so callers can paint arbitrary
points (entities, waypoints, POIs) without needing a new Rust widget
kind. Marker coordinates are normalised — [0..1] × [0..1] —
clamped so out-of-bounds entries paint at the edge.
Exports
minimap(opts: Opts?) -> any— build the canvas node. Returned directly by the module.
Types:
Marker = { x?: number, y?: number, color?: string, radius?: number }Style = { width?: number, height?: number, background?: string }Opts = { id?, classes?, label?, size?, background?, borderColor?, borderWidth?, borderRadius?, markers?: { Marker }, style?: Style }
Usage
local minimap = require("@builtin::modules.zui.widget.minimap")
local widget = minimap({
size = 200,
markers = {
{ x = 0.5, y = 0.5, color = "#FFC832", radius = 5 }, -- player
{ x = 0.2, y = 0.8, color = "#64C8FF" }, -- ally
{ x = 0.7, y = 0.3, color = "#C84040" }, -- enemy
},
})
Notes
- DOM mirror exposes the widget as
<canvas role="img" aria-label="Minimap">via the genericrole/aria*prop pass-through. - Legacy single-dot fallback ensures existing demos keep rendering even when no markers are supplied.
- The marker
radiusandcolorare per-marker — use them to encode per-entity context (size for distance, colour for faction, etc.).