Skip to content

LegendConfigSchema

const LegendConfigSchema: ZodObject<{ collapsed: ZodDefault<ZodBoolean>; items: ZodOptional<ZodArray<ZodObject<{ color: ZodString; icon: ZodOptional<ZodString>; label: ZodString; shape: ZodDefault<ZodEnum<["circle", "square", "line", "icon"]>>; }, "strip", ZodTypeAny, { color: string; icon?: string; label: string; shape: "circle" | "line" | "square" | "icon"; }, { color: string; icon?: string; label: string; shape?: "circle" | "line" | "square" | "icon"; }>, "many">>; position: ZodDefault<ZodEnum<["top-left", "top-right", "bottom-left", "bottom-right"]>>; title: ZodOptional<ZodString>; }, "strip", ZodTypeAny, { collapsed: boolean; items?: object[]; position: "top-left" | "top-right" | "bottom-left" | "bottom-right"; title?: string; }, { collapsed?: boolean; items?: object[]; position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; title?: string; }>

Defined in: packages/core/src/schemas/map.schema.ts:168

Legend configuration.

The legend displays layer information and can be positioned anywhere. If items is not provided, legend items are automatically extracted from layers with legend configuration.

Automatic Legend

legend:
title: "Map Legend"
position: top-left

Custom Legend Items

legend:
title: "Features"
position: top-left
collapsed: false
items:
- color: "#ff0000"
label: "High Priority"
shape: circle
- color: "#00ff00"
label: "Low Priority"
shape: circle