@velicons/web
v0.1.1
Published
Velicons web integration.
Readme
@velicons/web
Framework-neutral Web Components integration for Velicons. The package defines <velicons-icon> and <velicons-flag> custom elements and provides generated runtime definitions.
Installation
npm install @velicons/web
# or
bun add @velicons/webBrowser usage
Load the package as an ES module:
<script type="module">
import "@velicons/web";
</script>Then use the generated elements:
<velicons-icon name="a-arrow-down" aria-label="Move down"></velicons-icon>
<velicons-flag name="andorra" aria-label="Andorra"></velicons-flag>The elements support attributes including name, class, style, width, height, aria-label, and role.
Custom definitions
The runtime exposes VeliconDefinition and registerVeliconDefinition() for generated/runtime integrations that need to register an icon or flag definition explicitly.
import { registerVeliconDefinition } from "@velicons/web";
registerVeliconDefinition("icon", "my-icon", {
viewBox: "0 0 24 24",
body: "<path d=\"...\" />",
});Catalog and dynamic loading
Catalog and dynamic loading
The package root is for normal component usage. The generated catalog/registry and loader APIs are exposed through explicit subpaths.
import { getIcon, ICONS, libraries, loadIcon } from "@velicons/web/registry";
const icon = getIcon("a-arrow-down");
const allIcons = ICONS;
const allLibraries = libraries;
const loaded = await loadIcon("a-arrow-down");getIcon() resolves a canonical icon id, generated slug, or public name. The optional variant argument can be used when an icon has multiple variants.
For metadata-only consumption, use the package's catalog.json export instead of importing the runtime registry.
License
Velicons package and generated integration code are MIT licensed. Third-party artwork remains subject to its upstream license.
