Skip to main content

Interface: LayerControl

Defined in: spec/types.ts:858

A floating panel that expands to reveal one toggle button per LayerControlItem. Rendered by <GeoVisLayerControl>, which <GeoVisProvider> auto-mounts when spec.control is set.

Properties​

icon?​

optional icon?: string

Defined in: spec/types.ts:882

Icon shown on the collapsed trigger button, as a @ttoss/react-icons name (e.g. 'lucide:layers'). When omitted a built-in stacked-sheets glyph is used, so the trigger looks identical without configuration.


id​

id: string

Defined in: spec/types.ts:860

Unique identifier for the panel.


items​

items: LayerControlEntry[]

Defined in: spec/types.ts:923

What the expanded panel shows: toggle buttons (LayerControlItem), and optionally categories (LayerControlGroup) holding more of them, in any mix and in the order given. A control without groups behaves exactly as a flat list of toggles.


label?​

optional label?: string

Defined in: spec/types.ts:876

Text shown on the collapsed trigger button. Defaults to 'Layers'.


maxActiveItems?​

optional maxActiveItems?: number

Defined in: spec/types.ts:916

How many items can be on at once. Switching one on past the limit switches off the one switched on longest ago — items on by default count as the oldest, in items order — so a reader never has to make room before choosing. Only items whose layers exist in the spec count. When omitted there is no limit.

Applied as items are switched on: a control whose defaults already exceed it keeps them until the next switch.


maxVisibleItems?​

optional maxVisibleItems?: number

Defined in: spec/types.ts:905

How many items the expanded panel shows before collapsing the rest behind a "Ver mais" card. Clicking that card opens a larger panel listing every item, which stays open until dismissed (close button, Escape or a click outside) even for the 'hover' trigger. When omitted — or when items has no more than this many entries — every item is shown and no card appears.

The entries that are on come first — a category counts as on when any of its items is — in items order, and the rest fill the remaining places in that order too. So a layer switched on from the "Ver mais" panel is in the summary the next time it opens, and a layer that is on is never out of sight behind the card. More entries on than places grow the summary rather than hide one. The order is read when the panel opens and kept while it stays open, so a card never moves from under the pointer.


offset?​

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

Defined in: spec/types.ts:874

Distance in pixels from the anchored map edges. Defaults to 40. A single number applies to both edges; pass { x, y } to offset each axis independently (each falling back to 40 when omitted) — e.g. push the control clear of a side panel horizontally without lifting it off the bottom edge. Increase it to clear map chrome (e.g. MapLibre's attribution) or app UI.


position?​

optional position?: LegendPosition

Defined in: spec/types.ts:865

Corner the panel is anchored to (absolute overlay), reusing the legend position vocabulary. Defaults to 'bottom-left'.


trigger?​

optional trigger?: "hover" | "click"

Defined in: spec/types.ts:888

How the panel expands to reveal its items. 'hover' (default) expands on pointer/focus enter; 'click' toggles on trigger click. Both triggers still respond to a click so touch devices can open a hover panel.