Skip to main content

Interface: LegendSpec

Defined in: spec/types.legend.ts:181

Alternative color/legend configuration exposed by a layer. Consumers MAY present these as toggles; the active one is selected via activeLegendId.

Labels are always derived from the class breaks calculated by the application's classification pipeline — not from manually provided text. Use labelFormat to control how those breaks are formatted for display.

Properties​

colorBy?​

optional colorBy?: ColorBy

Defined in: spec/types.legend.ts:249

Declarative color-by configuration for a layer. When omitted, mergeLegends fills it from the auto-generated legend.


footerValue?​

optional footerValue?: string

Defined in: spec/types.legend.ts:202

Short value shown at the far right of the legend footer, e.g. a reference year ('2024'). Rendered beside the reference text.


icon?​

optional icon?: string

Defined in: spec/types.legend.ts:192

Icon rendered in a tinted chip beside the title, as a @ttoss/react-icons name (e.g. 'lucide:tractor'). When omitted no icon chip is shown.


iconColor?​

optional iconColor?: string

Defined in: spec/types.legend.ts:197

Accent color for the icon chip — tints both the glyph and (at low alpha) the chip background. Defaults to the legend's first swatch color.


id​

id: string

Defined in: spec/types.legend.ts:183

Unique identifier used to resolve this legend from GeoVisLegend.


labelFormat?​

optional labelFormat?: LabelFormatSpec

Defined in: spec/types.legend.ts:207

Controls how quantitative bin labels are generated. When omitted the default range style is used.


noDataLabel?​

optional noDataLabel?: string

Defined in: spec/types.legend.ts:234

Label for the "no data" swatch rendered at the bottom of the legend. When omitted no "no data" entry is shown.


normalization?​

optional normalization?: NormalizationSpec

Defined in: spec/types.legend.ts:212

Normalisation metadata for the mapped values. Used to append semantic suffixes when labelFormat.extended is true.


offset?​

optional offset?: number | { x?: number; y?: number; }

Defined in: spec/types.legend.ts:229

Distance in pixels from the anchored map edges (only applies with position). Defaults to 24. A single number applies to both edges; pass { x, y } to offset each axis independently — e.g. push the legend clear of a side panel horizontally without lifting it off the bottom edge. The anchored distance animates when it changes, so a shifting offset slides the legend across instead of teleporting.


position?​

optional position?: LegendPosition

Defined in: spec/types.legend.ts:220

Corner position for an absolutely-positioned legend overlay. When provided, GeoVisLegend applies CSS absolute positioning so the legend can be overlaid on the map without coupling to the map engine. When omitted the component renders in normal document flow and the caller is responsible for positioning.


reference?​

optional reference?: string

Defined in: spec/types.legend.ts:244

Bibliographic or institutional attribution displayed below the swatches.

Supports plain text and an inline link syntax: {link:visible text|https://example.com}

Example​

reference: 'Source: {link:IBGE Censo 2022|https://ibge.gov.br}'

subtitle?​

optional subtitle?: string

Defined in: spec/types.legend.ts:187

Secondary description rendered below the title.


title?​

optional title?: string

Defined in: spec/types.legend.ts:185

Short heading rendered above the legend swatches.