@road-signs/elements exports RoadSignElement, a base class for Custom Elements. It is
framework-agnostic and works in plain HTML, Angular, Svelte, or any environment that supports
the Custom Elements API.
npm install @road-signs/elements @road-signs/us
import { RoadSignElement } from ' @road-signs/elements ' ;
import { getSign } from ' @road-signs/us ' ;
// Register under any tag name
customElements . define ( ' road-sign ' , RoadSignElement);
// Attach a sign via the .sign setter
const el = document . createElement ( ' road-sign ' ) as RoadSignElement ;
el . sign = getSign ( ' w1-1-turn ' ) ! ;
el . setAttribute ( ' size ' , ' 64 ' );
document . body . appendChild (el);
<!-- Observed attributes update the rendered SVG -->
< road-sign size = " 64 " title = " Turn ahead " ></ road-sign >
Attribute
Default
Description
size
64
Sets both width and height in pixels
width
—
Overrides size width
height
—
Overrides size height
title
sign.name
Accessible <title> inside the SVG
description
sign.description
Accessible <desc> inside the SVG
Property
Type
Description
sign
Sign
Set the sign to render. Triggers a re-render.