Getting started
Installation
Section titled “Installation”Install a country package and a framework adapter:
npm install @road-signs/us @road-signs/reactnpm install @road-signs/us @road-signs/vuenpm install @road-signs/us @road-signs/elementsnpm install @road-signs/usQuick start
Section titled “Quick start”import { getSign } from '@road-signs/us';import { RoadSign } from '@road-signs/react';
const sign = getSign('w1-1-turn');
export default function App() { return <RoadSign sign={sign} size={64} />;}<script setup>import { getSign } from '@road-signs/us';import { RoadSign } from '@road-signs/vue';
const sign = getSign('w1-1-turn');</script>
<template> <RoadSign :sign="sign" :size="64" /></template>import { RoadSignElement } from '@road-signs/elements';import { getSign } from '@road-signs/us';
customElements.define('road-sign', RoadSignElement);
const el = document.createElement('road-sign') as RoadSignElement;el.sign = getSign('w1-1-turn')!;document.body.appendChild(el);<!-- Import the sprite stylesheet from the package dist --><link rel="stylesheet" href="node_modules/@road-signs/us/dist/sprite.css" />
<span class="rs-us-w1-1" style="display:inline-block;width:64px;height:64px" role="img" aria-label="Turn"></span>Finding sign IDs
Section titled “Finding sign IDs”Every sign has a slug ID derived from its code and name: {code-lowercase}-{name-slugified},
e.g. w1-1-turn.
Browse all signs in the Sign Gallery — the code is shown below each card.
You can also look up signs programmatically:
import { signs, getSign, getSignByCode, getSignsByCategory } from '@road-signs/us';
// All signssigns;
// By slug IDgetSign('w1-1-turn');
// By MUTCD codegetSignByCode('W1-1');
// By categorygetSignsByCategory('warning');TypeScript
Section titled “TypeScript”All packages ship full TypeScript types. Country packages narrow the category field to their
specific union:
import type { USSign, USCategory } from '@road-signs/us';import type { Sign } from '@road-signs/core';