Vanilla JavaScript
Render AXIcons to SVG strings with toSvg, for any framework, SSR or email.
Install
pnpm add @axcore/xiconstoSvg
Icons in the core package are plain data. toSvg turns one into an SVG string; the second argument overrides any root attribute.
import { IconCamera, toSvg } from "@axcore/xicons";
document.querySelector("#photo")!.innerHTML = toSvg(IconCamera, {
class: "size-5 text-sky-500",
"stroke-width": 1.5,
});Defaults: width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75", round caps and joins.
Vue, Svelte and others
Render the string with your framework's raw-HTML binding. The markup comes from the package, not user input.
<!-- Svelte -->
{@html toSvg(IconCamera)}
<!-- Vue -->
<span v-html="toSvg(IconCamera)" />Brand registry functions
| Function | Returns |
|---|---|
getIconSvg(name, variant?) | One SVG string from the brand registry. Default variant mono. |
getIcon(name) | The definition: title, category, website, aliases and every variant. |
hasIcon(name) | true when a name or alias exists. |
listIcons() | Every brand registry definition. |
Something wrong or missing?Open an issue