This JavaScript library gives website users more ways to interact with written ITU call signs, including for amateur radio.
See a live example at https://phieri.github.io/callsign.js/
Upload callsign.js and callsign.css to your web server and include the script on the page. The library creates a shadow root for each rendered call sign and injects the stylesheet automatically unless you override it with data-css-path.
<script id="callsign-js" src="callsign.js" defer></script>Tag the call signs with the custom HTML tag <call-sign>:
<p>I had contact with <call-sign>SM8AYA</call-sign> on shortwave.</p>Options can be set as attributes in the <script> tag.
| Name | Default | Description |
|---|---|---|
data-flag |
true |
Show a country flag before the call sign. |
data-monospace |
true |
Render the call sign with a monospace font. |
data-phonetic |
true |
Add phonetic information for screen readers and tooltips. |
data-search |
false |
Find and mark up untagged call signs in the document. |
data-css-path |
callsign.css |
Path to the stylesheet that the library injects into each shadow root. |
You can customize the appearance by overriding the CSS custom properties on the <call-sign> host element. These values flow into the shadow DOM that wraps each rendered call sign:
call-sign {
--cs-border-color: #007acc;
--cs-background-color: #e0f0ff;
--cs-border-radius: 5px;
}The project uses Jest for unit tests, ESLint for code quality checks, and manual browser validation for the rendered shadow-DOM output.
# Install dependencies
npm install
# Run all tests
npm test
# Run linting
npm run lintThe current suite covers the library's core behavior in browser-like conditions:
- call sign parsing and validation
- country prefix lookups and flag generation
- phonetic expansion
- auto-detection of untagged call signs in text content
The test files are located in the tests/ directory.
The files are intentionally not provided minified. Amateur radio is about learning and experimenting. Minified files makes it drastically harder to understand the code.
The PREFIX_TABLE mapping in this library is compiled from multiple authoritative sources to ensure accuracy across all 160 countries:
- ITU Radio Regulations Appendix 42 – Table of allocation of international call sign series - Official ITU allocation table
- ITU Radiocommunication Bureau Circular - Current call sign assignments and updates
- ARRL International Call Sign Series - Comprehensive amateur radio call sign reference
- ITU Master International Frequency Register (MIFR) - Official frequency and call sign database
- Country-specific amateur radio licensing authorities - National regulatory bodies via IARU member societies
- Radio-Electronics.com Call Sign Database - Cross-reference for prefix verification
- ITU Radio Regulations Article 19 – Identification of stations
- ITU prefix – Wikipedia
- International Amateur Radio Union (IARU) - Global amateur radio coordination