Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/spatialillusions/milsymbol/llms.txt

Use this file to discover all available pages before exploring further.

milsymbol is a pure JavaScript library for rendering military unit symbols according to the MIL-STD-2525 (B/C/D/E) and STANAG APP-6 (B/D/E) standards. It produces standards-compliant SVG strings, DOM elements, Canvas elements, and base64 data URLs — with no external dependencies.

Quickstart

Create your first military symbol in under 5 minutes

Installation

Install via npm, CDN, or direct download

Symbol Constructor

Full reference for the Symbol class and all options

API Reference

All Symbol methods with return types and examples

What is milsymbol?

milsymbol turns a Symbol Identification Code (SIDC) into a fully rendered military symbol. Pass a SIDC string and an options object; get back an SVG, a Canvas element, or a DOM node you can drop directly into any web mapping or visualization library.
import ms from "milsymbol";

const svg = new ms.Symbol("130315003611010300000000000000", {
  size: 35,
  quantity: "200",
  staffComments: "FOR REINFORCEMENTS",
  direction: (750 * 360) / 6400,
}).asSVG();

Key Features

Multiple Standards

Supports MIL-STD-2525B/C/D/E and STANAG APP-6 B/D/E — switch with a single call to ms.setStandard()

Zero Dependencies

One JavaScript file, no external libraries. Creates 1,000 symbols in under 20 milliseconds

Flexible Output

SVG strings, DOM elements, Canvas elements, OffscreenCanvas, and base64 data URLs

Rich Text Modifiers

All standard text fields: unit designation, DTG, location, quantity, higher formation, and more

Custom Color Modes

Built-in Light, Medium, and Dark palettes — plus full support for custom color modes per affiliation

Extensible

Add custom icons, override SIDCs, and insert symbol parts via a first-class extension API

Explore the Docs

Core Concepts

Understand SIDC codes, color modes, and draw instructions

Symbol Options

Every option available on the Symbol constructor

Text Modifiers

Add unit designations, DTG, location, and other text fields

Extending milsymbol

Custom icons, SIDC overrides, and symbol parts

Integrations

Use milsymbol with Leaflet, OpenLayers, Cesium, and D3

Output Formats

SVG, Canvas, DOM, OffscreenCanvas, and data URL output

Build docs developers (and LLMs) love