Skip to content

The symbol picker ​

createSymbolPicker puts a searchable picker on a page: every icon, frame and point of the catalog, searched by name, code or hierarchy, filtered by symbol set, in a chosen identity.

ts
import {createSymbolPicker} from '@zaes/military-symbols/picker';

const picker = createSymbolPicker(document.getElementById('picker')!, {
    onPick: (sidc, entity) => console.log(sidc, entity.path.join(' › ')),
});

picker.search('armor');
picker.setIdentity('6');          // hostile
picker.setSymbolSet('10');        // land units only; undefined for all
picker.destroy();
Option
onPickcalled with the code and its catalog entry
standard'2525E' (default) or '2525D' codes; 2525D leaves out what 2525D lacks
identitythe standard identity digit the thumbnails draw in
symbolSetswhich sets to offer
sizethumbnail size in pixels
displaythe display options of renderSymbol
identityControlshow the identity choice

It uses no framework and adds one <style> per document. Its colours are --zms-picker-* custom properties, and it follows light and dark; on a dark page each thumbnail sits on a light tile, since the symbols' black lines and fills are meant for a light ground.

Released under the MIT License; the drawings derive from Apache-2.0 work.