Skip to main content

MapKey

The key to the layers that are on, for the map itself: a panel named "Map key" with one block for each layer that has a key, so a person can read what the colours and shapes mean without opening the Layers section. It draws the same rows the section does (LayerKey). It minimises to a chip that shows a strip of glyphs and how many layers it covers, and renders nothing while no layer that is on has a key.

This is a function exported by @mapcairn/map, checked against version 0.2.0.

Signature​

import { MapKey } from "@mapcairn/map";

function MapKey(input: MapKeyProps): JSX.Element | null;

Parameters​

  • { layers, defaultMinimised }
  • input (MapKeyProps)

Returns​

JSX.Element | null

Remarks​

Put it in MapChrome's mapKey slot, which keeps it clear of the other floating elements and caps its height. The minimised state is held in memory, so it lasts for the visit but not a reload. The button's name is "Key, 3 layers" open and minimised, and aria-expanded says which.

See also​

Source: packages/map/src/layers/MapKey.tsx:66