Skip to content

@iso-safety-signs/elements

Terminal window
npm install @iso-safety-signs/elements

Call defineCustomElements() once at your app’s entry point before using any elements.

import { defineCustomElements } from '@iso-safety-signs/elements';
defineCustomElements();

By default elements are registered as iso-*. Pass a custom prefix to avoid collisions:

defineCustomElements('my-prefix');
// Registers <my-prefix-sign sign-id="...">, <my-prefix-e001-emergency-exit>, etc.

Use <iso-sign> when the sign is determined at runtime via the sign-id attribute.

<iso-sign sign-id="e001-emergency-exit" width="64" title="Emergency exit"></iso-sign>

Each sign also has a dedicated element named iso-{code} with no sign-id needed.

<iso-e001-emergency-exit width="64" title="Emergency exit"></iso-e001-emergency-exit>
<iso-p001-no-smoking width="48"></iso-p001-no-smoking>
<iso-w001-flammable width="48"></iso-w001-flammable>
AttributeTypeRequiredDescription
sign-idstringYes (<iso-sign> only)Sign ID, e.g. "e001-emergency-exit".
widthstringNoWidth in pixels as a string, e.g. "64".
heightstringNoHeight in pixels as a string, e.g. "64".
titlestringNoSets the SVG <title> for screen readers.
descriptionstringNoSets the SVG <desc> for additional context.

All attributes are reactive — changing them updates the rendered SVG immediately.

<!-- vite.config.ts: set compilerOptions.isCustomElement = (tag) => tag.startsWith('iso-') -->
<template>
<iso-sign sign-id="e001-emergency-exit" width="64" title="Emergency exit" />
</template>

Each element renders an <svg> with role="img". Provide a title attribute to give the sign an accessible name. For decorative usage, omit title and set aria-hidden="true" on the element itself.