JavaScript

@devigner-ui/icons-js: every icon as data, plus three functions that turn it into SVG. No framework. The artwork is rendered from the React package at build time, so the two cannot drift.

Install

Terminal
npm install @devigner-ui/icons-js

Placeholders

Mark where icons go, then swap them in once:

HTML
<i data-icon="BagStraps" data-variant="bold" class="size-6"></i>
JavaScript
import { createIcons, IconBagStraps } from "@devigner-ui/icons-js";

createIcons({ icons: { IconBagStraps } });

Only the icons you pass can be drawn, so the page ships only those. data-variant and data-stroke-width pick the drawing; every other attribute (class, style, aria-label) moves onto the <svg>.

Strings and elements

JavaScript
import { toSvg, toElement, IconAdd } from "@devigner-ui/icons-js";

el.innerHTML = toSvg(IconAdd, { variant: "bulk", attrs: { class: "size-6" } });
button.append(toElement(IconAdd));

toSvg runs on a server too, for templates and emails. Each icon can also be imported on its own:

JavaScript
import IconBagStraps from "@devigner-ui/icons-js/icons/BagStraps";

Options

Option Type Default What it does
variant "outline" | "twotone" | "bold" | "bulk" | "broken" "outline" Which drawing to render
strokeWidth string | number 1.5 Line weight of outline, twotone and broken
attrs object {} Attributes for the <svg>

Icons are decorative by default (aria-hidden="true"); an aria-label in attrs makes one an image.

Documentation

Browse all 12,480 icons