Skip to content

@public-information-symbols/core

Terminal window
npm install @public-information-symbols/core

Returns every symbol in the library as an array of PISymbol objects.

import { getAllSymbols } from '@public-information-symbols/core';
const symbols = getAllSymbols();
console.log(symbols.length); // total number of symbols

Returns the PISymbol for the given ID, or undefined if not found.

import { getSymbol } from '@public-information-symbols/core';
const symbol = getSymbol('ac-001-full-accessibility-or-toilets-accessible');
if (symbol) {
console.log(symbol.name); // "Full accessibility or toilets accessible"
console.log(symbol.category); // "accessibility"
console.log(symbol.assets[512]); // path to the 512 px SVG
}

Returns all symbols that belong to the given category.

import { getSymbolsByCategory } from '@public-information-symbols/core';
const accessibilitySymbols = getSymbolsByCategory('accessibility');
interface PISymbol {
id: string; // e.g. "ac-001-full-accessibility-or-toilets-accessible"
code: string; // e.g. "AC-001"
name: string; // human-readable name
description: string; // extended description
category: SymbolCategory;
svg: string; // inline SVG string
assets: SymbolAssets;
}
interface SymbolAssets {
240: string;
512: string;
768: string;
1024: string;
2048: string;
}
type SymbolCategory =
| 'accessibility'
| 'public-facilities'
| 'transportation'
| 'commercial'
| 'behaviour'
| 'tourism'
| 'sporting';